From 9488987332f2f4b8fa002a14f9717ed59e456852 Mon Sep 17 00:00:00 2001
From: cuilei <ray_tsu1@163.com>
Date: 星期三, 11 六月 2025 10:40:20 +0800
Subject: [PATCH] 工具管理-刀具准备单页面

---
 src/views/tms/PreparationOrderDetailList.vue                           |  205 +++++++++++
 src/views/tms/modules/preparationOrder/PreparationOrderModal.vue       |  328 ++++++++++++++++++
 src/views/tms/modules/preparationOrder/PreparationOrderDetailModal.vue |  143 +++++++
 src/views/tms/PreparationOrderList.vue                                 |  363 ++++++++++++++++++++
 4 files changed, 1,039 insertions(+), 0 deletions(-)

diff --git a/src/views/tms/PreparationOrderDetailList.vue b/src/views/tms/PreparationOrderDetailList.vue
new file mode 100644
index 0000000..fac235e
--- /dev/null
+++ b/src/views/tms/PreparationOrderDetailList.vue
@@ -0,0 +1,205 @@
+<template>
+  <a-card :bordered="false" :class="'cust-erp-sub-tab'">
+    <!-- 鏌ヨ鍖哄煙 -->
+    <div class="table-page-search-wrapper">
+      <a-form layout="inline" @keyup.enter.native="searchQuery">
+        <a-row :gutter="24">
+        </a-row>
+      </a-form>
+    </div>
+    <!-- 鏌ヨ鍖哄煙-END -->
+
+    <!-- 鎿嶄綔鎸夐挳鍖哄煙 -->
+<!--    <div class="table-operator" v-if="mainId">-->
+<!--      <a-button @click="handleAdd" type="primary" icon="plus">鏂板</a-button>-->
+<!--      <a-button type="primary" icon="download" @click="handleExportXls('鍒�鍏峰噯澶囧崟鏄庣粏')">瀵煎嚭</a-button>-->
+<!--      <a-upload-->
+<!--        name="file"-->
+<!--        :showUploadList="false"-->
+<!--        :multiple="false"-->
+<!--        :headers="tokenHeader"-->
+<!--        :action="importExcelUrl"-->
+<!--        @change="handleImportExcel">-->
+<!--          <a-button type="primary" icon="import">瀵煎叆</a-button>-->
+<!--      </a-upload>-->
+<!--      <a-dropdown v-if="selectedRowKeys.length > 0">-->
+<!--        <a-menu slot="overlay">-->
+<!--          <a-menu-item key="1" @click="batchDel"><a-icon type="delete"/>鍒犻櫎</a-menu-item>-->
+<!--        </a-menu>-->
+<!--        <a-button style="margin-left: 8px"> 鎵归噺鎿嶄綔 <a-icon type="down" /></a-button>-->
+<!--      </a-dropdown>-->
+<!--    </div>-->
+
+    <!-- table鍖哄煙-begin -->
+    <div>
+<!--      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">-->
+<!--        <i class="anticon anticon-info-circle ant-alert-icon"></i> 宸查�夋嫨 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>椤�-->
+<!--        <a style="margin-left: 24px" @click="onClearSelected">娓呯┖</a>-->
+<!--      </div>-->
+
+      <a-table
+        ref="table"
+        size="middle"
+        bordered
+        rowKey="id"
+        :scroll="{x:true}"
+        :columns="columns"
+        :dataSource="dataSource"
+        :pagination="ipagination"
+        :loading="loading"
+        :rowSelection="null"
+        @change="handleTableChange">
+
+<!--        <template slot="htmlSlot" slot-scope="text">-->
+<!--          <div v-html="text"></div>-->
+<!--        </template>-->
+<!--        <template slot="imgSlot" slot-scope="text,record">-->
+<!--          <span v-if="!text" style="font-size: 12px;font-style: italic;">鏃犲浘鐗�</span>-->
+<!--          <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>-->
+<!--        </template>-->
+<!--        <template slot="fileSlot" slot-scope="text">-->
+<!--          <span v-if="!text" style="font-size: 12px;font-style: italic;">鏃犳枃浠�</span>-->
+<!--          <a-button-->
+<!--            v-else-->
+<!--            :ghost="true"-->
+<!--            type="primary"-->
+<!--            icon="download"-->
+<!--            size="small"-->
+<!--            @click="downloadFile(text)">-->
+<!--            涓嬭浇-->
+<!--          </a-button>-->
+<!--        </template>-->
+
+<!--        <span slot="action" slot-scope="text, record">-->
+<!--          <a @click="handleEdit(record)">缂栬緫</a>-->
+<!--          <a-divider type="vertical" />-->
+<!--          <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)">-->
+<!--            <a>鍒犻櫎</a>-->
+<!--          </a-popconfirm>-->
+<!--        </span>-->
+
+      </a-table>
+    </div>
+
+    <preparationOrderDetail-modal ref="modalForm" @ok="modalFormOk" :mainId="mainId"></preparationOrderDetail-modal>
+  </a-card>
+</template>
+
+<script>
+
+  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+  import PreparationOrderDetailModal from './modules/preparationOrder/PreparationOrderDetailModal'
+
+  export default {
+    name: "PreparationOrderDetailList",
+    mixins:[JeecgListMixin],
+    components: { PreparationOrderDetailModal },
+    props:{
+      mainId:{
+        type:String,
+        default:'',
+        required:false
+      }
+    },
+    watch:{
+      mainId:{
+        immediate: true,
+        handler(val) {
+          if(!this.mainId){
+            this.clearList()
+          }else{
+            this.queryParam['preparationOrderId'] = val
+            this.loadData(1);
+          }
+        }
+      }
+    },
+    data () {
+      return {
+        description: '鍒�鍏峰噯澶囧崟绠$悊椤甸潰',
+        disableMixinCreated:true,
+        // 琛ㄥご
+        columns: [
+          {
+            title: '#',
+            dataIndex: '',
+            key:'rowIndex',
+            width:60,
+            align:"center",
+            customRender:function (t,r,index) {
+              return parseInt(index)+1;
+            }
+          },
+          {
+            title:'宸ュ叿缂栫爜',
+            align:"left",
+            dataIndex: 'toolNum'
+          },
+          {
+            title:'宸ュ叿绫诲瀷',
+            align:"center",
+            dataIndex: 'applicationType_dictText'
+          },
+          {
+            title:'涓枃鍚嶇О',
+            align:"center",
+            dataIndex: 'chineseName'
+          },
+          {
+            title:'鍨嬪彿/鍥惧彿',
+            align:"left",
+            dataIndex: 'toolModel'
+          },
+          {
+            title:'鍒�鍏锋潗鏂�',
+            align:"center",
+            dataIndex: 'toolMaterial'
+          },
+          {
+            title:'闆朵欢鏉愭枡',
+            align:"center",
+            dataIndex: 'partMaterial'
+          },
+          {
+            title:'鍘傚',
+            align:"center",
+            dataIndex: 'supplierId'
+          },
+          {
+            title:'鍑哄簱鏁伴噺',
+            align:"left",
+            dataIndex: 'outboundQuantity',
+            scopedSlots: { customRender: 'outboundQuantity' }
+          }
+        ],
+        url: {
+          list: "/tms/preparationOrder/listPreparationOrderDetailByMainId",
+          delete: "/tms/preparationOrder/deletePreparationOrderDetail",
+          deleteBatch: "/tms/preparationOrder/deleteBatchPreparationOrderDetail",
+          exportXlsUrl: "/tms/preparationOrder/exportPreparationOrderDetail",
+          importUrl: "/tms/preparationOrder/importPreparationOrderDetail",
+        },
+        dictOptions:{
+        }
+      }
+    },
+    created() {
+    },
+    computed: {
+      importExcelUrl(){
+        return `${window._CONFIG['domianURL']}/${this.url.importUrl}/${this.mainId}`;
+      }
+    },
+    methods: {
+      clearList(){
+        this.dataSource=[]
+        this.selectedRowKeys=[]
+        this.ipagination.current = 1
+      }
+
+    }
+  }
+</script>
+<style scoped>
+  @import '~@assets/less/common.less'
+</style>
diff --git a/src/views/tms/PreparationOrderList.vue b/src/views/tms/PreparationOrderList.vue
new file mode 100644
index 0000000..22f735f
--- /dev/null
+++ b/src/views/tms/PreparationOrderList.vue
@@ -0,0 +1,363 @@
+<template>
+  <a-card :bordered="false">
+    <!-- 鏌ヨ鍖哄煙 -->
+    <div class="table-page-search-wrapper">
+      <a-form layout="inline" @keyup.enter.native="searchQuery">
+        <a-row :gutter="24">
+          <a-col :xl="6" :lg="7" :md="8" :sm="24">
+            <a-form-item label="鍑嗗鍗曠紪鍙�">
+              <a-input placeholder="璇疯緭鍏ュ噯澶囧崟缂栧彿" v-model="queryParam.preparationOrderNum"></a-input>
+            </a-form-item>
+          </a-col>
+          <a-col :xl="6" :lg="7" :md="8" :sm="24">
+            <a-form-item label="鍗曟嵁鐘舵��">
+              <a-select placeholder="璇疯緭鍏ュ噯澶囧崟缂栧彿" v-model="queryParam.orderStatus">
+                <a-select-option value="1">寰呭鏍�</a-select-option>
+                <a-select-option value="2">宸插鏍�</a-select-option>
+                <a-select-option value="3">宸茶浆鍑�</a-select-option>
+              </a-select>
+            </a-form-item>
+          </a-col>
+          <a-col :xl="6" :lg="7" :md="8" :sm="24">
+            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
+              <a-button type="primary" @click="searchQuery" icon="search">鏌ヨ</a-button>
+              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">閲嶇疆</a-button>
+<!--              <a @click="handleToggleSearch" style="margin-left: 8px">-->
+<!--                {{ toggleSearchStatus ? '鏀惰捣' : '灞曞紑' }}-->
+<!--                <a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>-->
+<!--              </a>-->
+            </span>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+    <!-- 鏌ヨ鍖哄煙-END -->
+
+    <!-- 鎿嶄綔鎸夐挳鍖哄煙 -->
+    <div class="table-operator">
+<!--      <a-button @click="handleAdd" type="primary" icon="plus">鏂板</a-button>-->
+      <a-button @click="handleConvert" type="primary" icon="arrow-right">杞嚭搴撶敵璇峰崟</a-button>
+<!--      <a-button type="primary" icon="download" @click="handleExportXls('鍒�鍏峰噯澶囧崟')">瀵煎嚭</a-button>-->
+<!--      <a-upload name="file" :showUploadList="false" :multiple="false" :headers="tokenHeader" :action="importExcelUrl" @change="handleImportExcel">-->
+<!--        <a-button type="primary" icon="import">瀵煎叆</a-button>-->
+<!--      </a-upload>-->
+      <!-- 楂樼骇鏌ヨ鍖哄煙 -->
+<!--      <j-super-query :fieldList="superFieldList" ref="superQueryModal" @handleSuperQuery="handleSuperQuery"></j-super-query>-->
+    </div>
+
+    <!-- table鍖哄煙-begin -->
+    <div>
+      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px;">
+        <i class="anticon anticon-info-circle ant-alert-icon"></i> 宸查�夋嫨 <a style="font-weight: 600">{{ selectedRowKeys.length }}</a>椤�
+        <a style="margin-left: 24px" @click="onClearSelected">娓呯┖</a>
+      </div>
+
+      <a-table
+        ref="table"
+        size="middle"
+        bordered
+        rowKey="id"
+        class="j-table-force-nowrap"
+        :scroll="{x:true}"
+        :columns="columns"
+        :dataSource="dataSource"
+        :pagination="ipagination"
+        :loading="loading"
+        :rowSelection="{selectedRowKeys: selectedRowKeys, onChange: onSelectChange, type:'checkbox'}"
+        :customRow="clickThenSelect"
+        @change="handleTableChange">
+
+<!--        <template slot="htmlSlot" slot-scope="text">-->
+<!--          <div v-html="text"></div>-->
+<!--        </template>-->
+<!--        <template slot="imgSlot" slot-scope="text,record">-->
+<!--          <span v-if="!text" style="font-size: 12px;font-style: italic;">鏃犲浘鐗�</span>-->
+<!--          <img v-else :src="getImgView(text)" :preview="record.id" height="25px" alt="" style="max-width:80px;font-size: 12px;font-style: italic;"/>-->
+<!--        </template>-->
+<!--        <template slot="fileSlot" slot-scope="text">-->
+<!--          <span v-if="!text" style="font-size: 12px;font-style: italic;">鏃犳枃浠�</span>-->
+<!--          <a-button-->
+<!--            v-else-->
+<!--            :ghost="true"-->
+<!--            type="primary"-->
+<!--            icon="download"-->
+<!--            size="small"-->
+<!--            @click="downloadFile(text)">-->
+<!--            涓嬭浇-->
+<!--          </a-button>-->
+<!--        </template>-->
+
+        <span slot="action" slot-scope="text, record">
+          <a @click="handleDetail(record)">璇︽儏</a>
+          <span v-if="record.orderStatus === '1'">
+            <a-divider type="vertical" />
+            <a @click="handleConfirm(record)">瀹℃牳</a>
+            <a-divider type="vertical" />
+            <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)">
+                    <a>鍒犻櫎</a>
+            </a-popconfirm>
+          </span>
+
+<!--          <a-divider type="vertical" />-->
+<!--          <a-dropdown>-->
+<!--            <a class="ant-dropdown-link">鏇村 <a-icon type="down" /></a>-->
+<!--            <a-menu slot="overlay">-->
+<!--              <a-menu-item>-->
+<!--                <a @click="handleEdit(record)">缂栬緫</a>-->
+<!--              </a-menu-item>-->
+<!--              <a-menu-item>-->
+<!--                <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record.id)">-->
+<!--                  <a>鍒犻櫎</a>-->
+<!--                </a-popconfirm>-->
+<!--              </a-menu-item>-->
+<!--            </a-menu>-->
+<!--          </a-dropdown>-->
+        </span>
+
+      </a-table>
+    </div>
+
+    <a-tabs defaultActiveKey="1">
+      <a-tab-pane tab="鍒�鍏峰噯澶囧崟鏄庣粏" key="1" >
+        <PreparationOrderDetailList :mainId="preparationOrderDetailMainId" />
+      </a-tab-pane>
+    </a-tabs>
+
+    <preparationOrder-modal ref="modalForm" @ok="modalFormOk"></preparationOrder-modal>
+  </a-card>
+</template>
+
+<script>
+
+  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+  import PreparationOrderModal from './modules/preparationOrder/PreparationOrderModal'
+  import { getAction } from '@/api/manage'
+  import PreparationOrderDetailList from './PreparationOrderDetailList'
+  import '@/assets/less/TableExpand.less'
+  import { postAction } from '../../api/manage'
+
+  export default {
+    name: "PreparationOrderList",
+    mixins:[JeecgListMixin],
+    components: {
+      PreparationOrderDetailList,
+      PreparationOrderModal
+    },
+    data () {
+      return {
+        description: '鍒�鍏峰噯澶囧崟绠$悊椤甸潰',
+        // 琛ㄥご
+        columns: [
+          {
+            title:'鍑嗗鍗曠紪鍙�',
+            align:"left",
+            dataIndex: 'preparationOrderNum'
+          },
+          {
+            title:'闆朵欢鍥惧彿',
+            align:"center",
+            dataIndex: 'partDrawingNo'
+          },
+          {
+            title:'闆朵欢鍚嶇О',
+            align:"center",
+            dataIndex: 'partName'
+          },
+          {
+            title:'闆朵欢鏉愭枡',
+            align:"center",
+            dataIndex: 'partMaterial'
+          },
+          {
+            title:'宸ュ簭',
+            align:"center",
+            dataIndex: 'productionProcessesNo'
+          },
+          {
+            title:'鍔犲伐鎵规',
+            align:"center",
+            dataIndex: 'batchCode'
+          },
+          {
+            title:'鍔犲伐鏁伴噺',
+            align:"left",
+            dataIndex: 'machiningCount'
+          },
+          {
+            title:'鍔犲伐璁惧',
+            align:"center",
+            dataIndex: 'equipmentCode'
+          },
+          {
+            title:'绋嬪簭鍚�',
+            align:"center",
+            dataIndex: 'ncName'
+          },
+          {
+            title:'鍗曞瓙鐘舵��',
+            align:"center",
+            dataIndex: 'orderStatus_dictText'
+          },
+          {
+            title:'鎻愪氦鏃堕棿(鎻愪氦鑷冲嚭搴撶敵璇�)',
+            align:"center",
+            dataIndex: 'outboundTime'
+          },
+          {
+            title:'澶囨敞',
+            align:"center",
+            dataIndex: 'remark'
+          },
+          {
+            title:'鍒涘缓浜�',
+            align:"center",
+            dataIndex: 'createBy'
+          },
+          {
+            title:'鍒涘缓鏃堕棿(DNC鎺ㄩ�佹椂闂�)',
+            align:"center",
+            dataIndex: 'createTime'
+          },
+          {
+            title: '鎿嶄綔',
+            dataIndex: 'action',
+            align:"center",
+            fixed:"right",
+            width:147,
+            scopedSlots: { customRender: 'action' },
+          }
+        ],
+        url: {
+          list: "/tms/preparationOrder/list",
+          convertToOutboundOrder: "/tms/preparationOrder/convertToOutboundOrder",
+          delete: "/tms/preparationOrder/delete",
+          deleteBatch: "/tms/preparationOrder/deleteBatch",
+          exportXlsUrl: "/tms/preparationOrder/exportXls",
+          importExcelUrl: "tms/preparationOrder/importExcel",
+        },
+        dictOptions:{
+        },
+        /* 鍒嗛〉鍙傛暟 */
+        ipagination:{
+          current: 1,
+          pageSize: 5,
+          pageSizeOptions: ['5', '10', '50'],
+          showTotal: (total, range) => {
+            return range[0] + "-" + range[1] + " 鍏�" + total + "鏉�"
+          },
+          showQuickJumper: true,
+          showSizeChanger: true,
+          total: 0
+        },
+        selectedMainId:'',
+        superFieldList:[],
+        preparationOrderDetailMainId: '',
+      }
+    },
+    created() {
+      this.getSuperFieldList();
+    },
+    computed: {
+      importExcelUrl: function(){
+        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
+      }
+    },
+    methods: {
+      handleConvert() {
+        if (this.selectedRowKeys.length < 1) {
+          this.$message.warning('璇疯嚦灏戦�夋嫨涓�鏉$敵璇峰崟鏁版嵁锛�')
+          return
+        }
+        console.log(this.selectionRows)
+        console.log(this.selectedRowKeys)
+        postAction(this.url.convertToOutboundOrder, this.selectedRowKeys).then((res) => {
+          if (res.success) {
+            this.$message.success(res.message)
+            this.loadData(this.ipagination.current)
+          } else {
+            this.$message.warning(res.message)
+          }
+        })
+      },
+      handleConfirm(record) {
+        this.$refs.modalForm.edit(record);
+        this.$refs.modalForm.title = "瀹℃牳";
+        this.$refs.modalForm.disableSubmit = false;
+      },
+      searchReset() {
+        this.queryParam = {}
+        this.preparationOrderDetailMainId = ''
+        this.loadData(1)
+      },
+      initDictConfig(){
+      },
+      clickThenSelect(record) {
+        return {
+          on: {
+            click: () => {
+              this.onClickChange(record.id.split(","), [record]);
+            }
+          }
+        }
+      },
+      onClickChange(selectedRowKeys, selectionRows) {
+        this.preparationOrderDetailMainId = selectionRows[0]['id']
+      },
+      onClearSelected() {
+        this.selectedRowKeys = [];
+        this.selectionRows = [];
+        this.selectedMainId=''
+      },
+      onSelectChange(selectedRowKeys, selectionRows) {
+        this.selectedMainId=selectedRowKeys[0]
+        this.selectedRowKeys = selectedRowKeys;
+        this.selectionRows = selectionRows;
+      },
+      loadData(arg) {
+        if(!this.url.list){
+          this.$message.error("璇疯缃畊rl.list灞炴��!")
+          return
+        }
+        //鍔犺浇鏁版嵁 鑻ヤ紶鍏ュ弬鏁�1鍒欏姞杞界涓�椤电殑鍐呭
+        if (arg === 1) {
+          this.ipagination.current = 1;
+        }
+        this.onClearSelected()
+        var params = this.getQueryParams();//鏌ヨ鏉′欢
+        this.loading = true;
+        getAction(this.url.list, params).then((res) => {
+          if (res.success) {
+            this.dataSource = res.result.records;
+            this.ipagination.total = res.result.total;
+          }
+          if(res.code===510){
+            this.$message.warning(res.message)
+          }
+          this.loading = false;
+        })
+      },
+      getSuperFieldList(){
+        let fieldList=[];
+        fieldList.push({type:'string',value:'preparationOrderNum',text:'鍑嗗鍗曠紪鍙�',dictCode:''})
+        fieldList.push({type:'string',value:'partDrawingNo',text:'闆朵欢鍥惧彿',dictCode:''})
+        fieldList.push({type:'string',value:'partName',text:'闆朵欢鍚嶇О',dictCode:''})
+        fieldList.push({type:'string',value:'partMaterial',text:'闆朵欢鏉愭枡',dictCode:''})
+        fieldList.push({type:'string',value:'productionProcessesNo',text:'宸ュ簭锛堝伐姝ュ彿锛�',dictCode:''})
+        fieldList.push({type:'string',value:'batchCode',text:'鍔犲伐鎵规',dictCode:''})
+        fieldList.push({type:'string',value:'machiningCount',text:'鍔犲伐鏁伴噺',dictCode:''})
+        fieldList.push({type:'string',value:'equipmentCode',text:'鍔犲伐璁惧',dictCode:''})
+        fieldList.push({type:'string',value:'ncName',text:'绋嬪簭鍚�',dictCode:''})
+        fieldList.push({type:'BigDecimal',value:'outboundQuantity',text:'鍑嗗鍗曞嚭搴撴暟閲�',dictCode:''})
+        fieldList.push({type:'string',value:'orderStatus',text:'鍗曞瓙鐘舵��;1.鏈鏍革紱2.璋冩満鍛樺凡瀹℃牳锛�3.宸茶浆鍑哄簱鐢宠',dictCode:''})
+        fieldList.push({type:'date',value:'outboundTime',text:'鍑嗗鍗曟彁浜ゆ椂闂�;鎻愪氦鑷冲嚭搴撶敵璇峰崟鐨勬椂闂�'})
+        fieldList.push({type:'string',value:'remark',text:'澶囨敞',dictCode:''})
+        fieldList.push({type:'string',value:'createBy',text:'鍒涘缓浜�',dictCode:''})
+        fieldList.push({type:'date',value:'createTime',text:'鍒涘缓鏃堕棿;DNC鎺ㄩ�佹暟鎹椂闂�'})
+        this.superFieldList = fieldList
+      }
+    }
+  }
+</script>
+<style scoped>
+  @import '~@assets/less/common.less'
+</style>
\ No newline at end of file
diff --git a/src/views/tms/modules/preparationOrder/PreparationOrderDetailModal.vue b/src/views/tms/modules/preparationOrder/PreparationOrderDetailModal.vue
new file mode 100644
index 0000000..a282342
--- /dev/null
+++ b/src/views/tms/modules/preparationOrder/PreparationOrderDetailModal.vue
@@ -0,0 +1,143 @@
+<template>
+  <j-modal
+    :title="title"
+    :width="width"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    switchFullscreen
+    @ok="handleOk"
+    @cancel="handleCancel"
+    cancelText="鍏抽棴">
+    <a-spin :spinning="confirmLoading">
+      <a-form-model ref="form" :model="model" :rules="validatorRules">
+        <a-row>
+          <a-col :span="24">
+            <a-form-model-item label="鍑嗗鍗曞彿" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="preparationOrderId">
+              <a-input v-model="model.preparationOrderId"placeholder="璇疯緭鍏ュ噯澶囧崟鍙�" ></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="鍒�鍏风紪鐮�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="toolCode">
+              <a-input v-model="model.toolCode"placeholder="璇疯緭鍏ュ垁鍏风紪鐮�" ></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="鍒�鍏风紪鍙�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="toolId">
+              <a-input v-model="model.toolId"placeholder="璇疯緭鍏ュ垁鍏风紪鍙�" ></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="鐢宠鍑哄簱鏁伴噺" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="outboundQuantity">
+              <a-input-number v-model="model.outboundQuantity"placeholder="璇疯緭鍏ョ敵璇峰嚭搴撴暟閲�" style="width: 100%" />
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="24">
+            <a-form-model-item label="绉熸埛鍙�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="tenantId">
+              <a-input v-model="model.tenantId"placeholder="璇疯緭鍏ョ鎴峰彿" ></a-input>
+            </a-form-model-item>
+          </a-col>
+        </a-row>
+      </a-form-model>
+    </a-spin>
+  </j-modal>
+</template>
+
+<script>
+
+  import { httpAction } from '@/api/manage'
+  import { validateDuplicateValue } from '@/utils/util'
+
+  export default {
+    name: "PreparationOrderDetailModal",
+    components: {
+    },
+    props:{
+      mainId:{
+        type:String,
+        required:false,
+        default:''
+      }
+    },
+    data () {
+      return {
+        title:"鎿嶄綔",
+        width:800,
+        visible: false,
+        model:{
+        },
+        labelCol: {
+          xs: { span: 24 },
+          sm: { span: 5 },
+        },
+        wrapperCol: {
+          xs: { span: 24 },
+          sm: { span: 16 },
+        },
+
+        confirmLoading: false,
+        validatorRules: {
+        },
+        url: {
+          add: "/tms/preparationOrder/addPreparationOrderDetail",
+          edit: "/tms/preparationOrder/editPreparationOrderDetail",
+        }
+
+      }
+    },
+    created () {
+    //澶囦唤model鍘熷鍊�
+      this.modelDefault = JSON.parse(JSON.stringify(this.model));
+    },
+    methods: {
+      add () {
+        this.edit(this.modelDefault);
+      },
+      edit (record) {
+        this.model = Object.assign({}, record);
+        this.visible = true;
+      },
+      close () {
+        this.$emit('close');
+        this.visible = false;
+        this.$refs.form.clearValidate();
+      },
+      handleOk () {
+        const that = this;
+        // 瑙﹀彂琛ㄥ崟楠岃瘉
+        this.$refs.form.validate(valid => {
+          if (valid) {
+            that.confirmLoading = true;
+            let httpurl = '';
+            let method = '';
+            if(!this.model.id){
+              httpurl+=this.url.add;
+              method = 'post';
+            }else{
+              httpurl+=this.url.edit;
+               method = 'put';
+            }
+            this.model['preparationOrderId'] = this.mainId
+            httpAction(httpurl,this.model,method).then((res)=>{
+              if(res.success){
+                that.$message.success(res.message);
+                that.$emit('ok');
+              }else{
+                that.$message.warning(res.message);
+              }
+            }).finally(() => {
+              that.confirmLoading = false;
+              that.close();
+            })
+          }else{
+             return false
+          }
+        })
+      },
+      handleCancel () {
+        this.close()
+      },
+
+
+    }
+  }
+</script>
diff --git a/src/views/tms/modules/preparationOrder/PreparationOrderModal.vue b/src/views/tms/modules/preparationOrder/PreparationOrderModal.vue
new file mode 100644
index 0000000..95121b5
--- /dev/null
+++ b/src/views/tms/modules/preparationOrder/PreparationOrderModal.vue
@@ -0,0 +1,328 @@
+<template>
+  <j-modal
+    :title="title"
+    :width="width"
+    :visible="visible"
+    :confirmLoading="confirmLoading"
+    switchFullscreen
+    @ok="handleOk"
+    @cancel="handleCancel"
+    cancelText="鍏抽棴">
+    <a-spin :spinning="confirmLoading">
+      <a-form-model ref="form" :model="model" :rules="validatorRules">
+        <a-row>
+          <a-col :span="12">
+            <a-form-model-item label="鍑嗗鍗曠紪鍙�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="preparationOrderNum">
+              <a-input v-model="model.preparationOrderNum" placeholder="璇疯緭鍏ュ噯澶囧崟缂栧彿" disabled></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-model-item label="闆朵欢鍥惧彿" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="partDrawingNo">
+              <a-input v-model="model.partDrawingNo" placeholder="璇疯緭鍏ラ浂浠跺浘鍙�" disabled></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-model-item label="闆朵欢鍚嶇О" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="partName">
+              <a-input v-model="model.partName" placeholder="璇疯緭鍏ラ浂浠跺悕绉�" disabled></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-model-item label="闆朵欢鏉愭枡" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="partMaterial">
+              <a-input v-model="model.partMaterial" placeholder="璇疯緭鍏ラ浂浠舵潗鏂�" disabled></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-model-item label="宸ュ簭锛堝伐姝ュ彿锛�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="productionProcessesNo">
+              <a-input v-model="model.productionProcessesNo" placeholder="璇疯緭鍏ュ伐搴忥紙宸ユ鍙凤級" disabled></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-model-item label="鍔犲伐鎵规" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="batchCode">
+              <a-input v-model="model.batchCode" placeholder="璇疯緭鍏ュ姞宸ユ壒娆�" disabled></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-model-item label="鍔犲伐璁惧" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="equipmentCode">
+              <a-input v-model="model.equipmentCode" placeholder="璇疯緭鍏ュ姞宸ヨ澶�" disabled></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-model-item label="绋嬪簭鍚�" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="ncName">
+              <a-input v-model="model.ncName" placeholder="璇疯緭鍏ョ▼搴忓悕" disabled></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-model-item label="鍔犲伐鏁伴噺" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="machiningCount">
+              <a-input v-model="model.machiningCount" placeholder="璇疯緭鍏ュ姞宸ユ暟閲�" disabled></a-input>
+            </a-form-model-item>
+          </a-col>
+          <a-col :span="12">
+            <a-form-model-item label="澶囨敞" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="remark">
+              <a-textarea :disable="disableSubmit" v-model="model.remark" placeholder="璇疯緭鍏ュ娉�" ></a-textarea>
+            </a-form-model-item>
+          </a-col>
+        </a-row>
+      </a-form-model>
+
+      <a-table
+        ref="table"
+        size="middle"
+        bordered
+        rowKey="id"
+        :scroll="{x:true}"
+        :columns="columns"
+        :dataSource="dataSource"
+        :pagination="ipagination"
+        :loading="loading"
+        :rowSelection="null">
+
+        <template v-for="col in columns" :slot="col.dataIndex" slot-scope="text, record, index">
+          <div :key="col.dataIndex">
+            <a-input-number
+              v-if="col.dataIndex === 'outboundQuantity'"
+              :value="text"
+              @change="(e) => handleChange(e, record.key, col, index)"
+              :min="1"
+            />
+          </div>
+        </template>
+        <span slot="action" v-if="disableSubmit === false" slot-scope="text, record, index">
+        <a-popconfirm title="纭畾鍒犻櫎鍚�?" @confirm="() => handleDelete(record, index)">
+          <a>鍒犻櫎</a>
+        </a-popconfirm>
+      </span>
+
+      </a-table>
+    </a-spin>
+
+    <template slot="footer">
+      <a-button :style="{ marginRight: '8px' }" @click="handleCancel">鍏抽棴</a-button>
+      <a-button @click="handleOk" v-if="disableSubmit === false" type="primary">纭畾</a-button>
+    </template>
+  </j-modal>
+</template>
+
+<script>
+
+  import { httpAction } from '@/api/manage'
+  import { validateDuplicateValue } from '@/utils/util'
+  import { getAction } from '../../../../api/manage'
+
+  export default {
+    name: "PreparationOrderModal",
+    components: {
+    },
+    data () {
+      return {
+        title: "鎿嶄綔",
+        width: 1200,
+        visible: false,
+        model:{
+        },
+        labelCol: {
+          xs: { span: 24 },
+          sm: { span: 5 },
+        },
+        wrapperCol: {
+          xs: { span: 24 },
+          sm: { span: 16 },
+        },
+        loading: false,
+        dataSource: [],
+        /* 鍒嗛〉鍙傛暟 */
+        ipagination:{
+          current: 1,
+          pageSize: 10,
+          pageSizeOptions: ['10', '20', '30'],
+          showTotal: (total, range) => {
+            return range[0] + "-" + range[1] + " 鍏�" + total + "鏉�"
+          },
+          showQuickJumper: true,
+          showSizeChanger: true,
+          total: 0
+        },
+        // 琛ㄥご
+        columns: [
+          {
+            title: '#',
+            dataIndex: '',
+            key:'rowIndex',
+            width:60,
+            align:"center",
+            customRender:function (t,r,index) {
+              return parseInt(index)+1;
+            }
+          },
+          {
+            title:'宸ュ叿缂栫爜',
+            align:"left",
+            dataIndex: 'toolNum'
+          },
+          {
+            title:'宸ュ叿绫诲瀷',
+            align:"center",
+            dataIndex: 'applicationType_dictText'
+          },
+          {
+            title:'涓枃鍚嶇О',
+            align:"center",
+            dataIndex: 'chineseName'
+          },
+          {
+            title:'鍨嬪彿/鍥惧彿',
+            align:"left",
+            dataIndex: 'toolModel'
+          },
+          {
+            title:'鍒�鍏锋潗鏂�',
+            align:"center",
+            dataIndex: 'toolMaterial'
+          },
+          {
+            title:'闆朵欢鏉愭枡',
+            align:"center",
+            dataIndex: 'partMaterial'
+          },
+          {
+            title:'鍘傚',
+            align:"center",
+            dataIndex: 'supplierId'
+          },
+          {
+            title:'鍑哄簱鏁伴噺',
+            align:"left",
+            dataIndex: 'outboundQuantity',
+            scopedSlots: { customRender: 'outboundQuantity' }
+          },
+          {
+            title: '鎿嶄綔',
+            dataIndex: 'action',
+            align:"center",
+            fixed:"right",
+            width:147,
+            scopedSlots: { customRender: 'action' },
+          }
+        ],
+        confirmLoading: false,
+        validatorRules: {
+           outboundQuantity: [
+              { required: true, message: '璇疯緭鍏ュ噯澶囧崟鍑哄簱鏁伴噺!'},
+           ],
+           orderStatus: [
+              { required: true, message: '璇疯緭鍏ュ崟瀛愮姸鎬�;1.鏈鏍革紱2.璋冩満鍛樺凡瀹℃牳锛�3.宸茶浆鍑哄簱鐢宠!'},
+           ],
+           outboundTime: [
+              { required: true, message: '璇疯緭鍏ュ噯澶囧崟鎻愪氦鏃堕棿;鎻愪氦鑷冲嚭搴撶敵璇峰崟鐨勬椂闂�!'},
+           ],
+        },
+        url: {
+          list: "/tms/preparationOrder/listPreparationOrderDetailByMainId",
+          add: "/tms/preparationOrder/add",
+          edit: "/tms/preparationOrder/editTotal",
+          delete: "/tms/preparationOrder/deletePreparationOrderDetail"
+        }
+
+      }
+    },
+    created () {
+    //澶囦唤model鍘熷鍊�
+      this.modelDefault = JSON.parse(JSON.stringify(this.model));
+    },
+    methods: {
+      handleChange(value, key, column, index) {
+        console.log(value, key, column, index)
+        const temp = [...this.dataSource]
+        const target = temp.filter(item => key === item.key)[index];
+        if (target) {
+          target[column.dataIndex] = value
+          this.dataSource = temp
+          if(column.dataIndex === 'outboundQuantity'){
+            if(target['quantity']<value){
+              this.$message.error('鐢宠鍑哄簱鏁伴噺涓嶈兘澶т簬鍙敤搴撳瓨!')
+              this.isDisabled = true
+            }else{
+              this.isDisabled = false
+            }
+          }
+          this.dataSource = temp
+        }
+      },
+      add () {
+        this.edit(this.modelDefault);
+      },
+      edit (record) {
+        this.model = Object.assign({}, record);
+        getAction(this.url.list, { preparationOrderId: record.id}).then(res => {
+          if (res.success) {
+            this.dataSource = res.result.records || res.result;
+            if (res.result.total)
+            {
+              this.ipagination.total = res.result.total;
+            } else {
+              this.ipagination.total = 0;
+            }
+          } else {
+            this.$message.warning(res.message)
+          }
+        })
+        this.visible = true;
+      },
+      handleDelete(record, index) {
+        deleteAction(this.url.delete, { id: record.id }).then((res) => {
+          if (res.success) {
+            this.dataSource.splice(index, 1);
+            this.$message.success(res.message)
+          } else {
+            this.$message.warning(res.message)
+          }
+        });
+      },
+      close () {
+        this.$emit('close');
+        this.visible = false;
+        this.$refs.form.clearValidate();
+      },
+      handleOk () {
+        const that = this;
+        // 瑙﹀彂琛ㄥ崟楠岃瘉
+        this.$refs.form.validate(valid => {
+          if (valid) {
+            that.confirmLoading = true;
+            let httpurl = '';
+            let method = '';
+            this.model.preparationOrderDetailList = this.dataSource
+            if(!this.model.id){
+              httpurl+=this.url.add;
+              method = 'post';
+            }else{
+              httpurl+=this.url.edit;
+               method = 'put';
+               if (this.title === '瀹℃牳') {
+                 this.model.orderStatus = '2';
+               }
+            }
+            console.log(this.model)
+            httpAction(httpurl,this.model,method).then((res)=>{
+              if(res.success){
+                that.$message.success(res.message);
+                that.$emit('ok');
+              }else{
+                that.$message.warning(res.message);
+              }
+            }).finally(() => {
+              that.confirmLoading = false;
+              that.close();
+            })
+          }else{
+             return false
+          }
+        })
+      },
+      handleCancel () {
+        this.close()
+      },
+
+
+    }
+  }
+</script>
\ No newline at end of file

--
Gitblit v1.9.3