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

2024-11-03 大屏显示修改

luguang преди 3 седмици
родител
ревизия
0a1c3f26e4

+ 66 - 0
src/api/workshop/screenData.js

@@ -0,0 +1,66 @@
+import request from '@/utils/request'
+
+export function getScreenData(data = {}) {
+  return request({
+    url: '/screenData/get',
+    method: 'post',
+    data
+  })
+}
+
+export function listScreenData(data = {}) { // 不分页列表
+  return request({
+    url: '/screenData/list',
+    method: 'post',
+    data
+  })
+}
+
+export function pageScreenData(data = {}) { // 分页列表
+  return request({
+    url: '/screenData/page',
+    method: 'post',
+    data
+  })
+}
+
+export function updateScreenData(data = {}) {
+  return request({
+    url: '/screenData/update',
+    method: 'post',
+    data
+  })
+}
+
+export function addScreenData(data = {}) {
+  return request({
+    url: '/screenData/add',
+    method: 'post',
+    data
+  })
+}
+
+export function delScreenData(data = {}) {
+  return request({
+    url: '/screenData/delete',
+    method: 'post',
+    data
+  })
+}
+
+export function statusScreenData(data = {}) { // 状态
+  return request({
+    url: '/screenData/status',
+    method: 'post',
+    data
+  })
+}
+
+export function expScreenData(data = {}) { // 导出
+  return request({
+    url: '/screenData/exp',
+    method: 'post',
+    data
+  })
+}
+

+ 10 - 10
src/views/workshop/product/components/productEdit.vue

@@ -16,16 +16,16 @@
         style="width: 90%; margin-left:2%;"
       >
         <el-form-item label="产品名称" prop="productId">
-              <el-select v-model="editForm.productId"  @change="changeSecurities">
-                <el-option
-                  v-for="item in securitiesOpt"
-                  :key="item.id"
-                  :label="item.name"
-                  :value="item.id"
-                 
-                />
-              </el-select>
-            </el-form-item>
+          <el-select v-model="editForm.productId"  @change="changeSecurities">
+            <el-option
+              v-for="item in securitiesOpt"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id"
+              
+            />
+          </el-select>
+        </el-form-item>
         <el-form-item label="开始冠字号" prop="crownFrom">
           <el-input v-model="editForm.crownFrom">
             <template slot="prepend">{{crownPrefix}}</template>

+ 90 - 0
src/views/workshop/screenData/components/edit.vue

@@ -0,0 +1,90 @@
+<template>
+  <div class="app-container">
+    <!-- 大屏数据管理表表单 -->
+    <el-dialog :title="textMap[editType]+'大屏数据'" :visible.sync="editShow" :before-close="handleClose" :close-on-click-modal="false">
+      <el-form ref="editForm" :rules="editType==='update'?rules:rules" :model="editForm" label-position="right" label-width="7rem" style="width: 90%; margin-left:2%;">
+        <el-form-item label="产品名称" prop="securitiesId">
+          <el-select v-model="editForm.securitiesId">
+            <el-option
+              v-for="item in securitiesOpt"
+              :key="item.id"
+              :label="item.name"
+              :value="item.id"
+              
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="位置" prop="wareId">
+          <el-select v-model="editForm.wareId">
+            <el-option
+              v-for="item in wareOpt"
+              :key="item.val"
+              :label="item.name"
+              :value="item.val"
+              
+            />
+          </el-select>
+        </el-form-item>
+        <el-form-item label="当前库存(箱)" prop="qty">
+          <el-input v-model="editForm.qty" />
+        </el-form-item>
+        <el-form-item label="今日入库(箱)" prop="dayInQty">
+          <el-input v-model="editForm.dayInQty" />
+        </el-form-item>
+        <el-form-item label="今日出库(箱)" prop="dayOutQty">
+          <el-input v-model="editForm.dayOutQty" />
+        </el-form-item>
+      </el-form>
+      <span slot="footer" class="dialog-footer">
+        <el-button type="danger" @click="handleClose">关 闭</el-button>
+        <el-button v-show="editType!=='view'" type="primary" :disabled="isDisable" @click="confirmClick">保 存</el-button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+
+<script>
+import { getScreenData, addScreenData, updateScreenData } from '@/api/workshop/screenData'
+import MixinEdit from '@/utils/mixin-edit.js'
+
+export default {
+  mixins: [MixinEdit],
+  // eslint-disable-next-line vue/require-prop-types
+  props: ['editShow', 'editType', 'editId', 'securitiesOpt', 'wareOpt'],
+  data() {
+    return {
+      saveApi: addScreenData,
+      getApi: getScreenData,
+      rules: {
+        securitiesId: [{ required: true, message: '产品名称不能为空', trigger: 'change' }],
+        wareId: [{ required: true, message: '位置不能为空', trigger: 'change' }],
+        qty: [{ required: true, message: '当前库存(箱)不能为空', trigger: 'change' }],
+        dayInQty: [{ required: true, message: '今日入库(箱)不能为空', trigger: 'change' }],
+        dayOutQty: [{ required: true, message: '今日出库(箱)不能为空', trigger: 'change' }],
+      },
+      rulesUpdate: {
+      }
+    }
+  },
+  created() {
+    if (this.editType === 'update') {
+      this.saveApi = updateScreenData
+      this.getData(this.back)
+    }
+  },
+  mounted() {
+  },
+  methods: {
+    // 回调方法
+    back() {
+      this.$set(this.editForm, 'wareId', this.editForm.wareId + '')
+    }
+    // methods-end
+  }
+}
+</script>
+
+<style scoped lang="scss">
+
+</style>
+

+ 107 - 0
src/views/workshop/screenData/index.vue

@@ -0,0 +1,107 @@
+<template>
+  <div class="app-container">
+    <!-- 查询 -->
+    <div class="filter-container">
+      <el-select v-model="queryForm.securitiesId" class="filter-item" placeholder="品名" filterable clearable>
+        <el-option
+          v-for="item in securitiesOpt"
+          :key="item.id"
+          :label="item.name"
+          :value="item.id"
+        />
+      </el-select>
+      <el-button class="filter-item" type="primary" icon="el-icon-search" @click="search">查 询</el-button>
+      <el-button class="filter-item" type="primary" icon="el-icon-refresh" @click="resetQuery">重 置</el-button>
+    </div>
+    <!-- 功能 -->
+    <div class="filter-container">
+      <el-button class="filter-item" type="success" icon="el-icon-plus" @click="handleAdd()">新 增</el-button>
+    </div>
+    <!-- 大屏数据管理表列表 -->
+    <el-table v-loading="listLoading" row-key="id" :data="tableData" border stripe fit highlight-current-row>
+      <el-table-column type="selection" align="center" prop="id" />
+      <el-table-column label="NO" prop="id" align="center" width="40" type="index" />
+      <el-table-column label="产品名称" align="center" prop="securities" />
+      <el-table-column label="位置" align="center" prop="wareCn" />
+      <el-table-column label="当前库存(箱)" align="center" prop="qty" />
+      <el-table-column label="今日入库(箱)" align="center" prop="dayInQty" />
+      <el-table-column label="今日出库(箱)" align="center" prop="dayOutQty" />
+      <el-table-column label="状态" min-width="40" align="center">
+          <template slot-scope="{ row }">
+            <el-tag
+              style="cursor: pointer"
+              :type="row.status | statusFilter"
+              @click="handleStatus(row)"
+            >
+              {{ $commonArray.methods.getArrayVal('statusOpt', row.status) }}
+            </el-tag>
+          </template>
+        </el-table-column>
+      <el-table-column label="操作" align="center">
+        <template slot-scope="{row}">
+          <el-link type="primary" :underline="false" @click="handleUpdate(row)">编辑</el-link>
+          <el-divider direction="vertical" />
+          <el-link type="primary" :underline="false" @click="handleDelete(row)">删除</el-link>
+        </template>
+      </el-table-column>
+    </el-table>
+    <!-- 分页 -->
+    <pagination v-show="pageTotal>0" :total="pageTotal" :page.sync="page" :limit.sync="rows" @pagination="getList" />
+    <!-- 新增/编辑 -->
+    <Edit
+      v-if="editShow"
+      ref="edit"
+      :edit-show="editShow"
+      :edit-type="editType"
+      :edit-id="editId"
+      :securities-opt="securitiesOpt"
+      :ware-opt="wareOpt"
+    />
+  </div>
+</template>
+
+<script>
+import { pageScreenData, delScreenData, statusScreenData } from '@/api/workshop/screenData'
+import Edit from './components/edit'
+import Pagination from '@/components/Pagination'
+import Mixin from '@/utils/mixin.js'
+import Dictionaries from '@/utils/dictionaries.js'
+
+export default {
+  name: 'ScreenData',
+  components: { Pagination, Edit },
+  filters: {
+    statusFilter(status) {
+      const statusMap = {
+        1: 'success',
+        2: 'danger',
+        3: 'info',
+        0: 'danger'
+      }
+      return statusMap[status]
+    }
+  },
+  mixins: [Mixin, Dictionaries],
+  data() {
+    return {
+      listApi: pageScreenData, // 列表
+      delApi: delScreenData, // 删除
+      statusApi: statusScreenData, // 状态
+    }
+  },
+  created() {
+    this.getDictOptList('wareOpt') // 总库选项
+    this.listSecuritiesOpt() // 品名选项
+    this.getPageList()
+  },
+  mounted() {
+  },
+  methods: {
+    // methods-end
+  }
+}
+</script>
+
+<style scoped lang="scss">
+
+</style>