|
@@ -0,0 +1,271 @@
|
|
|
|
|
+<template>
|
|
|
|
|
+ <div>
|
|
|
|
|
+ <layout>
|
|
|
|
|
+ <layout-header>
|
|
|
|
|
+ <div class="product-header">
|
|
|
|
|
+ <el-input
|
|
|
|
|
+ v-model="searchKeyword"
|
|
|
|
|
+ placeholder="搜索工艺编码或名称"
|
|
|
|
|
+ clearable
|
|
|
|
|
+ style="width: 220px; margin: 5px"
|
|
|
|
|
+ @keyup.enter="onSearch"
|
|
|
|
|
+ @clear="onSearch"
|
|
|
|
|
+ />
|
|
|
|
|
+ <el-button type="primary" icon="Search" style="margin: 5px" @click="onSearch">查询</el-button>
|
|
|
|
|
+ <el-button type="primary" icon="Plus" style="margin: 5px" @click="onAdd">新增</el-button>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </layout-header>
|
|
|
|
|
+
|
|
|
|
|
+ <layout>
|
|
|
|
|
+ <layout-sider :resize-directions="['right']" :width="200" style="margin-right: 10px">
|
|
|
|
|
+ <div class="product-menu-wrap">
|
|
|
|
|
+ <h3 class="product-menu-title">工序</h3>
|
|
|
|
|
+ <el-tree
|
|
|
|
|
+ ref="menuTreeRef"
|
|
|
|
|
+ :data="menuTreeData"
|
|
|
|
|
+ class="treecolor product-menu-tree"
|
|
|
|
|
+ :props="treeProps"
|
|
|
|
|
+ node-key="id"
|
|
|
|
|
+ default-expand-all
|
|
|
|
|
+ highlight-current
|
|
|
|
|
+ @node-click="handleNodeClick"
|
|
|
|
|
+ >
|
|
|
|
|
+ <template #default="{ data }">
|
|
|
|
|
+ <span class="tree-node-text">{{ data.label }}</span>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-tree>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </layout-sider>
|
|
|
|
|
+
|
|
|
|
|
+ <layout-content>
|
|
|
|
|
+ <el-main class="product-main">
|
|
|
|
|
+ <div class="gva-table-box">
|
|
|
|
|
+ <el-table
|
|
|
|
|
+ :data="tableData"
|
|
|
|
|
+ border
|
|
|
|
|
+ size="small"
|
|
|
|
|
+ style="width: 100%; height: 60vh"
|
|
|
|
|
+ :row-style="{ height: '20px' }"
|
|
|
|
|
+ :header-cell-style="{ padding: '0px' }"
|
|
|
|
|
+ :cell-style="{ padding: '0px' }"
|
|
|
|
|
+ :header-row-style="{ height: '20px' }"
|
|
|
|
|
+ row-key="id"
|
|
|
|
|
+ :show-overflow-tooltip="true"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-table-column align="center" label="工艺编码" prop="工艺编码" width="100" />
|
|
|
|
|
+ <el-table-column align="left" label="工艺名称" prop="工艺名称" width="160" show-overflow-tooltip />
|
|
|
|
|
+ <el-table-column align="center" label="生产工序" prop="生产工序" width="90" />
|
|
|
|
|
+ <el-table-column align="center" label="标准工时" prop="标准工时" width="80" />
|
|
|
|
|
+ <el-table-column align="center" label="标准工分" prop="标准工分" width="80" />
|
|
|
|
|
+ <el-table-column align="center" label="操作人" prop="sys_id" width="90" />
|
|
|
|
|
+ <el-table-column align="center" label="创建时间" prop="创建时间" width="115" />
|
|
|
|
|
+ <el-table-column align="center" label="修改时间" prop="修改时间" width="115" />
|
|
|
|
|
+ <el-table-column align="center" label="操作" width="130">
|
|
|
|
|
+ <template #default="{ row }">
|
|
|
|
|
+ <el-button type="primary" size="small" @click="onEdit(row)">编辑</el-button>
|
|
|
|
|
+ <el-button type="danger" size="small" @click="onDelete(row)">删除</el-button>
|
|
|
|
|
+ </template>
|
|
|
|
|
+ </el-table-column>
|
|
|
|
|
+ </el-table>
|
|
|
|
|
+ <div class="gva-pagination">
|
|
|
|
|
+ <el-pagination
|
|
|
|
|
+ v-model:current-page="page"
|
|
|
|
|
+ v-model:page-size="pageSize"
|
|
|
|
|
+ :page-sizes="[10, 20, 30, 50]"
|
|
|
|
|
+ :total="total"
|
|
|
|
|
+ layout="total, sizes, prev, pager, next, jumper"
|
|
|
|
|
+ background
|
|
|
|
|
+ small
|
|
|
|
|
+ @current-change="fetchData"
|
|
|
|
|
+ @size-change="onPageSizeChange"
|
|
|
|
|
+ />
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ </el-main>
|
|
|
|
|
+ </layout-content>
|
|
|
|
|
+ </layout>
|
|
|
|
|
+ </layout>
|
|
|
|
|
+ </div>
|
|
|
|
|
+</template>
|
|
|
|
|
+
|
|
|
|
|
+<script setup>
|
|
|
|
|
+import { Layout, LayoutSider, LayoutContent } from '@arco-design/web-vue'
|
|
|
|
|
+import { ref, onMounted, nextTick } from 'vue'
|
|
|
|
|
+import { ProcessList, ProcessDelete } from '@/api/yunyin/product'
|
|
|
|
|
+import { ElMessage, ElMessageBox } from 'element-plus'
|
|
|
|
|
+
|
|
|
|
|
+defineOptions({ name: 'ProductProcess' })
|
|
|
|
|
+
|
|
|
|
|
+const menuTreeRef = ref(null)
|
|
|
|
|
+const treeProps = { label: 'label', children: 'children' }
|
|
|
|
|
+const menuTreeData = ref([
|
|
|
|
|
+ {
|
|
|
|
|
+ id: 'process-all',
|
|
|
|
|
+ label: '全部工序',
|
|
|
|
|
+ isAll: true
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ id: 'process-裁剪',
|
|
|
|
|
+ label: '裁剪',
|
|
|
|
|
+ code: '裁剪'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ id: 'process-车缝',
|
|
|
|
|
+ label: '车缝',
|
|
|
|
|
+ code: '车缝'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ id: 'process-手工',
|
|
|
|
|
+ label: '手工',
|
|
|
|
|
+ code: '手工'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ id: 'process-大烫',
|
|
|
|
|
+ label: '大烫',
|
|
|
|
|
+ code: '大烫'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ id: 'process-总检',
|
|
|
|
|
+ label: '总检',
|
|
|
|
|
+ code: '总检'
|
|
|
|
|
+ },
|
|
|
|
|
+ {
|
|
|
|
|
+ id: 'process-包装',
|
|
|
|
|
+ label: '包装',
|
|
|
|
|
+ code: '包装'
|
|
|
|
|
+ }
|
|
|
|
|
+])
|
|
|
|
|
+
|
|
|
|
|
+const tableData = ref([])
|
|
|
|
|
+const total = ref(0)
|
|
|
|
|
+const page = ref(1)
|
|
|
|
|
+const pageSize = ref(30)
|
|
|
|
|
+const searchKeyword = ref('')
|
|
|
|
|
+const selectedCode = ref(null)
|
|
|
|
|
+
|
|
|
|
|
+const fetchData = async () => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ const params = {
|
|
|
|
|
+ page: page.value,
|
|
|
|
|
+ limit: pageSize.value,
|
|
|
|
|
+ }
|
|
|
|
|
+ const kw = searchKeyword.value.trim()
|
|
|
|
|
+ if (kw) {
|
|
|
|
|
+ params.search = kw
|
|
|
|
|
+ }
|
|
|
|
|
+ if (selectedCode.value) {
|
|
|
|
|
+ params.code = selectedCode.value
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ const res = await ProcessList(params)
|
|
|
|
|
+ if (res?.code !== 0) {
|
|
|
|
|
+ ElMessage.error(res?.msg || '获取工艺资料失败')
|
|
|
|
|
+ tableData.value = []
|
|
|
|
|
+ total.value = 0
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ const payload = res.data || {}
|
|
|
|
|
+ tableData.value = Array.isArray(payload.list) ? payload.list : []
|
|
|
|
|
+ const c = payload.count ?? payload.total
|
|
|
|
|
+ total.value = c != null ? Number(c) : tableData.value.length
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ console.error(e)
|
|
|
|
|
+ tableData.value = []
|
|
|
|
|
+ total.value = 0
|
|
|
|
|
+ ElMessage.error('获取工艺资料失败')
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const handleNodeClick = (data) => {
|
|
|
|
|
+ if (data.isAll) {
|
|
|
|
|
+ selectedCode.value = null
|
|
|
|
|
+ } else {
|
|
|
|
|
+ selectedCode.value = data.code
|
|
|
|
|
+ }
|
|
|
|
|
+ page.value = 1
|
|
|
|
|
+ fetchData()
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const onSearch = () => {
|
|
|
|
|
+ page.value = 1
|
|
|
|
|
+ fetchData()
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const onPageSizeChange = () => {
|
|
|
|
|
+ page.value = 1
|
|
|
|
|
+ fetchData()
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const onAdd = () => {
|
|
|
|
|
+ ElMessage.info('新增功能待开发')
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const onEdit = (row) => {
|
|
|
|
|
+ ElMessage.info('编辑功能待开发')
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+const onDelete = async (row) => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ await ElMessageBox.confirm('确定要删除该工艺资料吗?', '提示', {
|
|
|
|
|
+ confirmButtonText: '确定',
|
|
|
|
|
+ cancelButtonText: '取消',
|
|
|
|
|
+ type: 'warning',
|
|
|
|
|
+ })
|
|
|
|
|
+
|
|
|
|
|
+ const res = await ProcessDelete({ id: row.id })
|
|
|
|
|
+ if (res?.code !== 0) {
|
|
|
|
|
+ ElMessage.error(res?.msg || '删除失败')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+ ElMessage.success('删除成功')
|
|
|
|
|
+ fetchData()
|
|
|
|
|
+ } catch (e) {
|
|
|
|
|
+ if (e !== 'cancel') {
|
|
|
|
|
+ console.error(e)
|
|
|
|
|
+ ElMessage.error('删除失败')
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+onMounted(async () => {
|
|
|
|
|
+ await nextTick()
|
|
|
|
|
+ menuTreeRef.value?.setCurrentKey('process-all')
|
|
|
|
|
+ fetchData()
|
|
|
|
|
+})
|
|
|
|
|
+</script>
|
|
|
|
|
+
|
|
|
|
|
+<style scoped>
|
|
|
|
|
+.product-header {
|
|
|
|
|
+ padding: 4px 0;
|
|
|
|
|
+}
|
|
|
|
|
+.product-menu-wrap {
|
|
|
|
|
+ background: #fff;
|
|
|
|
|
+ padding: 10px;
|
|
|
|
|
+ min-height: 260px;
|
|
|
|
|
+ max-height: calc(100vh - 140px);
|
|
|
|
|
+ overflow: auto;
|
|
|
|
|
+}
|
|
|
|
|
+.product-menu-title {
|
|
|
|
|
+ font-size: 15px;
|
|
|
|
|
+ font-weight: 700;
|
|
|
|
|
+ margin: 0 0 10px;
|
|
|
|
|
+}
|
|
|
|
|
+.tree-node-text {
|
|
|
|
|
+ font-size: 13px;
|
|
|
|
|
+}
|
|
|
|
|
+.product-menu-wrap :deep(.product-menu-tree.el-tree .el-tree-node.is-current > .el-tree-node__content) {
|
|
|
|
|
+ color: red;
|
|
|
|
|
+}
|
|
|
|
|
+.product-menu-wrap :deep(.product-menu-tree.el-tree .el-tree-node.is-current > .el-tree-node__content .tree-node-text) {
|
|
|
|
|
+ color: red;
|
|
|
|
|
+ font-weight: 600;
|
|
|
|
|
+}
|
|
|
|
|
+.product-main {
|
|
|
|
|
+ padding-bottom: 8px;
|
|
|
|
|
+}
|
|
|
|
|
+.gva-pagination {
|
|
|
|
|
+ margin-top: 5px;
|
|
|
|
|
+ display: flex;
|
|
|
|
|
+ justify-content: flex-end;
|
|
|
|
|
+}
|
|
|
|
|
+</style>
|