From c95e7e5af5e80d6603b8dfc922201079b27b9056 Mon Sep 17 00:00:00 2001
From: zhangherong <571457620@qq.com>
Date: 星期二, 09 九月 2025 19:29:03 +0800
Subject: [PATCH] art: 上料列表、新增页面

---
 src/views/cms/modules/JSelectInventoryModal.vue |  256 +++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 256 insertions(+), 0 deletions(-)

diff --git a/src/views/cms/modules/JSelectInventoryModal.vue b/src/views/cms/modules/JSelectInventoryModal.vue
new file mode 100644
index 0000000..c4b2d97
--- /dev/null
+++ b/src/views/cms/modules/JSelectInventoryModal.vue
@@ -0,0 +1,256 @@
+<template>
+  <!--鏀寔鍏ㄥ睆缂╂斁-->
+  <!--閫夋嫨鍒�鍏风殑寮圭獥锛屾牴鎹繖涓脊绐楀皢閫夋嫨鍒�鍏蜂粠鍒�鍏蜂俊鎭縼绉诲埌鍒�鍏峰簱瀛橈紝鐢ㄦ潵棰嗙敤鍒�鍏峰簱瀛橀噷鐨勫垁鍏�  -->
+  <j-modal
+    :visible="visible"
+    :title="title"
+    switchFullscreen
+    :width="1200"
+    @ok="handleSubmit"
+    @cancel="close"
+    style="top: 50px"
+    cancelText="鍏抽棴"
+  >
+    <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.cuttingCode"></a-input>
+              </a-form-item>
+            </a-col>
+            <a-col :xl="6" :lg="7" :md="8" :sm="24">
+              <a-form-item label="鍒�鍏峰悕绉�">
+                <a-input placeholder="璇疯緭鍏ュ垁鍏峰悕绉�,鏀寔妯$硦鏌ヨ" v-model="queryParam.cuttingName"></a-input>
+              </a-form-item>
+            </a-col>
+
+            <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-row>
+        </a-form>
+      </div>
+      <!--鍒�鍏峰垪琛�-->
+      <a-table
+        ref="table"
+        :scroll="scrollTrigger"
+        size="middle"
+        rowKey="id"
+        :columns="columns"
+        :dataSource="dataSource"
+        :pagination="ipagination"
+        :rowSelection="rowSelection"
+        :loading="loading"
+        @change="handleTableChange"
+      >
+      </a-table>
+    </a-card>
+  </j-modal>
+</template>
+
+<script>
+import { filterObj } from '@/utils/util'
+import { getAction } from '@/api/manage'
+
+export default {
+  name: 'JSelectInventoryModal',
+  components: {},
+  props: {},
+  data() {
+    return {
+      queryParam: {},
+      columns: [
+        {
+          title: '#',
+          dataIndex: '',
+          key: 'rowIndex',
+          width: 50,
+          align: 'center',
+          customRender: function (t, r, index) {
+            return parseInt(index) + 1
+          },
+        },
+        {
+          title: '鍒�鍏风紪鐮�',
+          align: 'center',
+          dataIndex: 'cuttingCode',
+          sorter: true,
+        },
+        {
+          title: '鍒�鍏峰悕绉�',
+          align: 'center',
+          dataIndex: 'cuttingName',
+          sorter: true,
+        },
+        {
+          title: '鍒�鍏峰垎绫�',
+          align: 'center',
+          dataIndex: 'cuttingCategory',
+          sorter: true,
+        },
+        {
+          title:'鍒�鍏锋潯鐮�',
+          align: 'center',
+          dataIndex: 'cuttingBarcode',
+          sorter: true,
+        },
+        {
+          title:'鍒�鍏峰綋鍓嶅鍛斤紙鐧惧垎姣旓級',
+          align: 'center',
+          dataIndex: 'currentLife',
+          sorter: true,
+        },
+      ],
+      selectedRowKeys: [],
+      oldSlelectRows: [],
+      scrollTrigger: {},
+      dataSource: [],
+      selectionRows: [],
+      title: '鏍规嵁鏌ヨ缁撴灉閫夋嫨鍒�鍏�',
+      ipagination: {
+        current: 1,
+        pageSize: 10,
+        pageSizeOptions: ['5', '10', '20'],
+        showTotal: (total, range) => {
+          return range[0] + '-' + range[1] + ' 鍏�' + total + '鏉�'
+        },
+        showQuickJumper: true,
+        showSizeChanger: true,
+        total: 0,
+      },
+      isorter: {
+        column: 'num',
+        order: 'desc',
+      },
+      departTree: [],
+      visible: false,
+      loading: false,
+      url: {
+        // list: '/cms/cuttingTool/getCuttingToolList',
+        list:'/cms/cuttingReceive/getInventoryToolList'
+      },
+    }
+  },
+  computed: {
+    rowSelection() {
+      return {
+        type: 'checkbox',
+        onChange: (selectedRowKeys, selectedRows) => {
+          this.selectedRowKeys = selectedRowKeys
+          this.onSelectChange(selectedRows)
+        },
+        getCheckboxProps: (record) => ({
+          props: {
+            disabled: record.distable,
+          },
+        }),
+        selectedRowKeys: this.selectedRowKeys,
+      }
+    },
+  },
+  watch: {},
+  created() {},
+  methods: {
+    async loadData(arg) {
+      if (arg === 1) {
+        this.ipagination.current = 1
+      }
+      let that = this
+      this.loading = true
+      let params = this.getQueryParams() //鏌ヨ鏉′欢
+      await getAction(this.url.list, params).then((res) => {
+        if (res.success) {
+          for (let i = 0; i < res.result.records.length; i++) {
+            if (that.oldSlelectRows.indexOf(res.result.records[i].id) > -1) {
+              res.result.records[i].distable = true
+            } else {
+              res.result.records[i].distable = false
+            }
+          }
+          this.dataSource = res.result.records
+          this.ipagination.total = res.result.total
+        }
+        if (res.code === 510) {
+          this.$message.warning(res.message)
+        }
+        this.loading = false
+      })
+    },
+    showModal(oldSlelectRows) {
+      this.oldSlelectRows = oldSlelectRows
+      this.visible = true
+      this.loadData(1)
+    },
+    getQueryParams() {
+      let param = Object.assign({}, this.queryParam, this.isorter)
+      param.field = this.getQueryField()
+      param.pageNo = this.ipagination.current
+      param.pageSize = this.ipagination.pageSize
+      return filterObj(param)
+    },
+    //鏌ヨ鏉′欢澶勭悊
+    getQueryField() {
+      let str = 'id,'
+      for (let a = 0; a < this.columns.length; a++) {
+        str += ',' + this.columns[a].dataIndex
+      }
+      return str
+    },
+    searchReset(num) {
+      let that = this
+      if (num !== 0) {
+        that.loadData(1)
+      }
+      that.selectborrowIds = []
+    },
+    close() {
+      this.searchReset(0)
+      this.selectedRowKeys = []
+      this.visible = false
+    },
+    handleTableChange(pagination, filters, sorter) {
+      //TODO 绛涢��
+      if (Object.keys(sorter).length > 0) {
+        this.isorter.column = sorter.field
+        this.isorter.order = 'ascend' === sorter.order ? 'asc' : 'desc'
+      }
+      this.ipagination = pagination
+      this.loadData()
+    },
+    handleSubmit() {
+      this.$bus.$emit('selectionRows', this.selectionRows)
+      this.searchReset(0)
+      this.close()
+    },
+    onSelectChange(selectionRows) {
+      this.selectionRows = selectionRows
+    },
+    onSearch() {
+      this.loadData(1)
+    },
+    searchQuery() {
+      this.loadData(1);
+    },
+    // searchReset() {
+    //   this.queryParam = {}
+    //   this.loadData(1)
+    // },
+  },
+}
+</script>
+
+<style scoped>
+.ant-table-tbody .ant-table-row td {
+  padding-top: 10px;
+  padding-bottom: 10px;
+}
+
+#components-layout-demo-custom-trigger .trigger {
+  font-size: 18px;
+  line-height: 64px;
+  padding: 0 24px;
+  cursor: pointer;
+  transition: color 0.3s;
+}
+</style>
\ No newline at end of file

--
Gitblit v1.9.3