From e4e75a7312f5195144b105d59ac90f26e174d4ba Mon Sep 17 00:00:00 2001
From: lixiangyu <lixiangyu@xalxzn.com>
Date: 星期五, 05 九月 2025 18:02:54 +0800
Subject: [PATCH] feat(cms): 优化刀具入库和库存列表功能

---
 src/views/base/PrinterConfigList.vue |  328 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 328 insertions(+), 0 deletions(-)

diff --git a/src/views/base/PrinterConfigList.vue b/src/views/base/PrinterConfigList.vue
new file mode 100644
index 0000000..932cc76
--- /dev/null
+++ b/src/views/base/PrinterConfigList.vue
@@ -0,0 +1,328 @@
+<template>
+  <a-card
+    :bordered="false"
+  >
+    <!-- 鏌ヨ鍖哄煙 -->
+    <div class="table-page-search-wrapper">
+      <a-form
+        layout="inline"
+        @keyup.enter.native="searchQuery"
+      >
+        <a-row :gutter="30">
+
+          <a-col :xl="6" :lg="7" :md="8" :sm="24">
+            <a-form-item label="鎵撳嵃鏈篒P">
+              <j-input
+                placeholder="璇疯緭鍏ユ墦鍗版満IP妫�绱�"
+                v-model="queryParam.printerIp "
+              ></j-input>
+            </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="info" @click="searchReset" icon="reload" style="margin-left: 8px">閲嶇疆</a-button>
+            </span>
+          </a-col>
+        </a-row>
+      </a-form>
+    </div>
+
+    <!-- 鎿嶄綔鎸夐挳鍖哄煙 -->
+    <div class="table-operator">
+      <a-button
+        @click="handleAdd"
+        type="primary"
+        icon="plus"
+      >鏂板
+      </a-button>
+    </div>
+
+    <!-- table鍖哄煙-begin -->
+    <div>
+      <a-table
+        ref="table"
+        size="middle"
+        bordered
+        rowKey="id"
+        filterMultiple="filterMultiple"
+        :columns="columns"
+        :rowClassName="tableRowClass"
+        :dataSource="dataSource"
+        :pagination="ipagination"
+        :loading="loading"
+        @change="handleTableChange"
+      >
+        <!--鐘舵�佹爮涓�у睍绀�-->
+        <span
+          slot="status"
+          slot-scope="text,record"
+        >
+          <a-badge
+            v-if="record.printerStatus==1"
+            status="success"
+          />
+          <span
+            v-if="record.printerStatus==1"
+            class="success"
+          >鍚敤</span>
+          <a-badge
+            v-if="record.printerStatus==0"
+            status="error"
+          />
+          <span
+            v-if="record.printerStatus==0"
+            class="error"
+          >绂佺敤</span>
+        </span>
+        <span
+          slot="action"
+          slot-scope="text, record"
+        >
+          <a
+            href="javascript:;"
+            @click="handleEdit(record)"
+          >缂栬緫</a>
+
+          <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="handleDetail(record)">璇︽儏</a>
+              </a-menu-item>
+               <a-menu-item v-if="record.printerStatus == 0">
+                <a-popconfirm
+                  title="纭畾鍚敤鍚�?"
+                  @confirm="() => handleActive(record.id)"
+                >
+                  <a>鍚敤</a>
+                </a-popconfirm>
+              </a-menu-item>
+              <a-menu-item v-if="record.printerStatus == 1">
+                <a-popconfirm
+                  title="纭畾绂佺敤鍚�?"
+                  @confirm="() => handleActive(record.id)"
+                >
+                  <a>绂佺敤</a>
+                </a-popconfirm>
+              </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>
+    <!-- table鍖哄煙-end -->
+
+    <!-- 琛ㄥ崟鍖哄煙 -->
+    <printer-config-model
+      ref="modalForm"
+      @ok="modalFormOk"
+    ></printer-config-model>
+  </a-card>
+</template>
+
+<script>
+//鎸夐渶寮曞叆 缁勪欢
+import PrinterConfigModel from './modules/printerConfig/PrinterConfigModel'
+
+import { getAction, requestPut } from '@/api/manage'
+import { JeecgListMixin } from '@/mixins/JeecgListMixin'
+import JEllipsis from '@/components/jeecg/JEllipsis'
+import JInput from '@/components/jeecg/JInput'
+
+export default {
+  name: 'PrinterConfigList',
+  mixins: [JeecgListMixin],
+  components: {
+    PrinterConfigModel,
+    JEllipsis,
+    JInput
+  },
+  data() {
+    return {
+      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
+      },
+      /* 鎺掑簭鍙傛暟 */
+      isorter:{
+        column: 'printerIp',
+        order: 'asc',
+      },
+      // 琛ㄥご
+      columns: [
+        {
+          title: '#',
+          dataIndex: '',
+          key: 'rowIndex',
+          width: 60,
+          align: 'center',
+          customRender: function(t, r, index) {
+            return parseInt(index) + 1
+          }
+        },
+        {
+          title: '鎵撳嵃鏈篒P',
+          align: 'center',
+          dataIndex: 'printerIp'
+        },
+        {
+          title: '鎵撳嵃鏈哄悕绉�',
+          align: 'center',
+          dataIndex: 'printerName'
+        },
+        {
+          title: '鎵撳嵃鏈虹鍙�',
+          align: 'center',
+          dataIndex: 'portNumber'
+        },
+        {
+          title: '鎵撳嵃鏈哄瀷鍙�',
+          align: 'center',
+          dataIndex: 'printerModel'
+        },
+        {
+          width: 100,
+          title: '鐘舵��',
+          align: 'center',
+          scopedSlots: {
+            customRender: 'status'
+          },
+          dataIndex: 'printerStatus'
+        },
+        {
+          width: 150,
+          title: '鎿嶄綔',
+          dataIndex: 'action',
+          align: 'center',
+          scopedSlots: { customRender: 'action' }
+        }
+      ],
+      url: {
+        list: '/base/printerConfig/list',
+        delete: '/base/printerConfig/delete',
+        active: '/base/printerConfig/active'
+      }
+    }
+  },
+  mounted() {
+
+  },
+  methods: {
+    loadData(arg) {
+      if (arg === 1) {
+        this.ipagination.current = 1
+      }
+      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
+      })
+    },
+    //绂佺敤鐘舵�佹牱寮�
+    tableRowClass(record, index) {
+      if (record.printerStatus != '1') {
+        return 'frozenRowClass'
+      }
+      return ''
+    },
+    //鍚敤绂佺敤
+    handleActive(id) {
+      if (!this.url.active) {
+        this.$message.error('璇疯缃畊rl.active!')
+        return
+      }
+      let that = this
+      requestPut(that.url.active, {}, { id: id }).then((res) => {
+        if (res.success) {
+          that.$message.success(res.message)
+          that.loadData()
+        } else {
+          that.$message.warning(res.message)
+        }
+      })
+    }
+  }
+
+}
+</script>
+<style lang="less" scoped>
+@import '~@assets/less/common.less';
+
+.frozenRowClass {
+  color: #c9c9c9;
+}
+
+.success {
+  color: green;
+}
+
+.error {
+  color: red;
+}
+
+.fontweight {
+  font-weight: bold;
+}
+
+.ant-card-body .table-operator {
+  margin-bottom: 18px;
+}
+
+.ant-table-tbody .ant-table-row td {
+  padding-top: 15px;
+  padding-bottom: 15px;
+}
+
+.anty-row-operator button {
+  margin: 0 5px;
+}
+
+/deep/ .ant-btn-danger {
+  background-color: #ffffff;
+}
+
+.ant-modal-cust-warp {
+  height: 100%;
+}
+
+.ant-modal-cust-warp .ant-modal-body {
+  height: calc(100% - 110px) !important;
+  overflow-y: auto;
+}
+
+.ant-modal-cust-warp .ant-modal-content {
+  height: 90% !important;
+  overflow-y: hidden;
+}
+</style>
\ No newline at end of file

--
Gitblit v1.9.3