| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423 |
- <template>
- <div>
- <el-container>
- <!-- 左侧树形结构 -->
- <el-scrollbar max-height="80vh">
- <el-aside width="280px">
- <div class="JKWTree-tree">
- <h3>工单超节损核算</h3>
- <el-tree
- :data="treeData"
- highlight-current
- @node-click="handleNodeClick"
- />
- </div>
- </el-aside>
- </el-scrollbar>
- <el-container>
- <el-main>
- <div class="gva-table-box">
- <!-- 按钮区域 -->
- <div class="gva-btn-list">
- <el-row :span="6">
- <el-input
- v-model="searchInfo"
- placeholder="输入工单编号或产品名称"
- />
- </el-row>
- <el-button
- type="primary"
- :icon="Search"
- @click="onSearch"
- >定位</el-button>
- <el-button
- type="primary"
- :icon="Download"
- style="margin-left: auto;"
- @click="exportExcel"
- >导出到Excel</el-button>
- </div>
- <!-- 数据展示 -->
- <el-table
- style="width: 100%;height:30vh;"
- :data="tableData"
- row-key="ID"
- highlight-current-row
- border
- :row-style="{ height: '20px' }"
- :cell-style="{ padding: '0px' }"
- :header-row-style="{ height: '20px' }"
- :header-cell-style="{ padding: '0px' }"
- @selection-change="handleSelectionChange"
- @row-dblclick="doubleClick"
- >
- <el-table-column
- type="selection"
- width="55"
- />
- <!-- 使用 v-for 循环渲染每一列 -->
- <el-table-column
- v-for="column in tableCols"
- :key="column.prop"
- :prop="column.prop"
- :label="column.label"
- :width="column.width"
- show-overflow-tooltip="true"
- />
- </el-table>
- <br>
- <el-table
- style="width: 100%;height: 40vh;"
- row-key="ID"
- highlight-current-row
- border
- :row-style="{ height: '20px' }"
- :cell-style="{ padding: '0px' }"
- :header-row-style="{ height: '20px' }"
- :header-cell-style="{ padding: '0px' }"
- @selection-change="handleSelectionChange"
- @row-dblclick="doubleClick"
- >
- <el-table-column
- type="selection"
- width="55"
- />
- <!-- 使用 v-for 循环渲染每一列 -->
- <el-table-column
- v-for="column in tableCols"
- :key="column.prop"
- :prop="column.prop"
- :label="column.label"
- :width="column.width"
- show-overflow-tooltip="true"
- />
- </el-table>
- </div>
- <!-- 弹出框 -->
- </el-main>
- </el-container>
- </el-container>
- </div>
- </template>
- <script setup>
- // 全量引入格式化工具 请按需保留
- import { ElMessage, ElMessageBox } from 'element-plus'
- import { Search, Refresh, Download } from '@element-plus/icons-vue'
- import { ref, reactive, onMounted } from 'vue'
- import { getSide, getTable } from '@/api/mes_api_gty/orderAccounting'
- defineOptions({
- name: '12orderAccounting'
- })
- // 侧边栏数据
- const treeData = ref([])
- const getSideData = async() => {
- const res = await getSide()
- if (res.code === 0) {
- const { data } = res
- const transformedData = []
- for (const [key, value] of Object.entries(data)) {
- const [date, total] = key.split('-') // 提取日期和数量
- const transformedItem = {
- label: `${date}(工单数:${total})`,
- children: value.map(item => ({
- label: `${item['客户编号']}【${item['客户名称']}】(工单数:${item.total})`
- })),
- }
- transformedData.push(transformedItem)
- }
- treeData.value = transformedData
- }
- }
- getSideData()
- // 自动化生成的字典(可能为空)以及字段
- const formData = ref({
- id: '',
- name: '',
- date: '',
- group: '',
- packingOutput: '',
- reworkOutput: '',
- pieceOutput: '',
- order: '',
- user: '',
- createTime: '',
- updateTime: '',
- uniqid: '',
- })
- // 验证规则
- const rule = reactive({
- })
- const elFormRef = ref()
- const elSearchFormRef = ref()
- // =========== 表格控制部分 ===========
- const tableCols = [
- { label: '工单编号', prop: 'qczl_gdbh', width: '100' },
- { label: '印件号', prop: 'qczl_yjno', width: '100' },
- { label: '印件名称', prop: 'Gd_cpmc', width: '400' },
- { label: '日期', prop: 'qczl_rq', width: '100' },
- { label: '流程单号', prop: 'qczl_num', width: '100' },
- { label: '流程单备注', prop: 'qczl_NumDesc', width: '100' },
- { label: '总废品', prop: 'qczl_fp', width: '100' },
- { label: '废品1', prop: 'sl_lb1', width: '250' },
- { label: '废品2', prop: 'sl_lb2', width: '250' },
- { label: '废品3', prop: 'sl_lb3', width: '250' },
- { label: '废品4', prop: 'sl_lb4', width: '250' },
- { label: '废品5', prop: 'sl_lb5', width: '250' },
- { label: '废品6', prop: 'sl_lb6', width: '250' },
- { label: '废品7', prop: 'sl_lb7', width: '250' },
- { label: '废品8', prop: 'sl_lb8', width: '250' },
- { label: '废品9', prop: 'sl_lb9', width: '250' },
- { label: '废品10', prop: 'sl_lb10', width: '250' },
- { label: '废品11', prop: 'sl_lb11', width: '250' },
- { label: '废品12', prop: 'sl_lb12', width: '250' },
- { label: '废品13', prop: 'sl_lb13', width: '250' },
- { label: '废品14', prop: 'sl_lb14', width: '250' },
- { label: '废品15', prop: 'sl_lb15', width: '250' },
- { label: '废品16', prop: 'sl_lb16', width: '250' },
- { label: '废品17', prop: 'sl_lb17', width: '250' },
- { label: '创建用户', prop: 'sys_id', width: '200' },
- ]
- const tableData = reactive([])
- const detailData = reactive([
- {
- gdbh: '2311736',
- yjgx: '01-15',
- gxmc: '包装(圆切)',
- yjmc: '利群(新)小《降焦改版)',
- bzcl: '13.00',
- fgcl: '0.00',
- mxsl: '2500',
- jcxs: '1.000',
- ly: '',
- dedh: '030002002',
- },
- ])
- const total = ref(0)
- const page = ref(1)
- const limit = ref(10)
- const searchInfo = ref('')
- const params = {
- date: '',
- sys_id: '',
- page: page.value.toString(),
- limit: limit.value.toString(),
- }
- const getTableData = async() => {
- try {
- const response = await getOrderVerificationTable(params)
- if (response.code === 0) {
- tableData.splice(0, tableData.length, ...response.data.rows)
- }
- } catch (error) {
- console.log(error)
- }
- }
- const handleNodeClick = (node, check) => {
- if (node.params) {
- params.date = node.params.date
- params.sys_id = node.params.sys_id
- total.value = node.params.total
- getTableData()
- }
- }
- // 搜索
- function onSearch() {
- }
- // ============== 表格控制部分结束 ===============
- // 获取需要的字典 可能为空 按需保留
- const setOptions = async() => {
- }
- // 获取需要的字典 可能为空 按需保留
- setOptions()
- // 多选数据
- const multipleSelection = ref([])
- // 多选
- const handleSelectionChange = (val) => {
- multipleSelection.value = val
- }
- // 批量删除控制标记
- const deleteVisible = ref(false)
- // 多选删除
- const onDelete = async() => {
- const ids = []
- if (multipleSelection.value.length === 0) {
- ElMessage({
- type: 'warning',
- message: '请选择要删除的数据'
- })
- return
- }
- multipleSelection.value &&
- multipleSelection.value.map(item => {
- ids.push(item.ID)
- })
- const res = await deleteCompanyByIds({ ids })
- if (res.code === 0) {
- ElMessage({
- type: 'success',
- message: '删除成功'
- })
- if (tableData.value.length === ids.length && page.value > 1) {
- page.value--
- }
- deleteVisible.value = false
- getTableData()
- }
- }
- // 行为控制标记(弹窗内部需要增还是改)
- const type = ref('')
- // 更新行
- const updateCompanyFunc = async(row) => {
- const res = await findCompany({ ID: row.ID })
- type.value = 'update'
- if (res.code === 0) {
- formData.value = res.data.recompany
- dialogFormVisible.value = true
- }
- }
- // 弹窗控制标记
- const dialogFormVisible = ref(false)
- // 打开弹窗
- const openDialog = () => {
- type.value = 'create'
- dialogFormVisible.value = true
- }
- // 关闭弹窗
- const closeDialog = () => {
- dialogFormVisible.value = false
- formData.value = {
- address: '',
- image: '',
- name: '',
- }
- }
- // 弹窗确定
- const enterDialog = async() => {
- elFormRef.value?.validate(async(valid) => {
- if (!valid) return
- let res
- switch (type.value) {
- case 'create':
- res = await createCompany(formData.value)
- break
- case 'update':
- res = await updateCompany(formData.value)
- break
- default:
- res = await createCompany(formData.value)
- break
- }
- if (res.code === 0) {
- ElMessage({
- type: 'success',
- message: '创建/更改成功'
- })
- closeDialog()
- getTableData()
- }
- })
- }
- // 双击表格操作
- function doubleClick(row, column, event) {
- console.log(row, column, event)
- // updateCompanyFunc(row);
- type.value = 'update'
- dialogFormVisible.value = true
- }
- // 导出excel
- function exportExcel() {
- console.log('导出到excel')
- }
- // 生命周期钩子
- onMounted(async() => {
- })
- </script>
- <style scoped>
- .JKWTree-container {
- display: flex;
- }
- .JKWTree-tree {
- width: 300px;
- background-color: #fff;
- padding: 10px;
- margin-right: 20px;
- }
- .JKWTree-tree h3 {
- font-size: 15px;
- font-weight: 700;
- margin: 10px 0;
- }
- .JKWTree-content {
- flex: 1;
- }
- /* 选中某行时的背景色 */
- :deep(.el-table__body tr.current-row) > td {
- background: #ff80ff !important;
- }
- </style>
- <style scoped>
- :deep(.el-table td .cell) {
- line-height: 20px !important;
- }
- :deep(.el-tabs__header){
- margin-bottom: 0;
- }
- .search{
- margin-left: 0px !important;
- margin-right: 10px !important;
- }
- .bt{
- margin-left: 2px !important;
- padding: 3px !important;
- font-size: 12px;
- }
- .el-tabs__header{
- margin: 0px !important;
- }
- .gva-table-box{
- padding: 0px !important;
- }
- .mab{
- margin-bottom: 5px;
- }
- </style>
|