基础资料优化处理

main
GaoF 2024-08-07 17:55:26 +08:00
parent d60c2992f7
commit f31d914790
30 changed files with 2871 additions and 84 deletions

View File

@ -24,5 +24,9 @@ export default {
// 获取员工详情
employeeDetail(data) {
return request('detail', data, 'get')
},
// 添加员工基本信息
employeeAddShort(data) {
return request('addShort', data, 'post')
}
}

View File

@ -0,0 +1,36 @@
import { baseRequest } from '@/utils/request'
const request = (url, ...arg) => baseRequest(`/produce/manualtask/` + url, ...arg)
/**
* 手工任务单Api接口管理器
*
* @author Luck
* @date 2024/08/06 16:54
**/
export default {
// 获取手工任务单分页
manualTaskPage(data) {
return request('page', data, 'get')
},
// 获取手工任务单【详情】分页
manualTaskDetailPage(data) {
return request('/detail/page', data, 'get')
},
// 提交手工任务单表单 edit为true时为编辑默认为新增
manualTaskSubmitForm(data, edit = false) {
return request(edit ? 'edit' : 'add', data)
},
// 提交 保存任务单 标签、备注信息
manualTaskSaveTag(data) {
return request('saveTag', data)
},
// 删除手工任务单
manualTaskDelete(data) {
return request('delete', data)
},
// 获取手工任务单详情
manualTaskDetail(data) {
return request('detail', data, 'get')
}
}

View File

@ -0,0 +1,32 @@
import { baseRequest } from '@/utils/request'
const request = (url, ...arg) => baseRequest(`/produce/manualtasktag/` + url, ...arg)
/**
* 手工任务单标签Api接口管理器
*
* @author Luck
* @date 2024/08/06 18:28
**/
export default {
// 获取手工任务单标签分页
manualTaskTagPage(data) {
return request('page', data, 'get')
},
// 获取手工任务单标签 列表
manualTaskTagList(data) {
return request('list', data, 'get')
},
// 提交手工任务单标签表单 edit为true时为编辑默认为新增
manualTaskTagSubmitForm(data, edit = false) {
return request(edit ? 'edit' : 'add', data)
},
// 删除手工任务单标签
manualTaskTagDelete(data) {
return request('delete', data)
},
// 获取手工任务单标签详情
manualTaskTagDetail(data) {
return request('detail', data, 'get')
}
}

View File

@ -0,0 +1,28 @@
import { baseRequest } from '@/utils/request'
const request = (url, ...arg) => baseRequest(`/produce/task/` + url, ...arg)
/**
* 生产任务单Api接口管理器
*
* @author Luck
* @date 2024/08/06 10:39
**/
export default {
// 获取生产任务单分页
produceTaskPage(data) {
return request('page', data, 'get')
},
// 提交生产任务单表单 edit为true时为编辑默认为新增
produceTaskSubmitForm(data, edit = false) {
return request(edit ? 'edit' : 'add', data)
},
// 删除生产任务单
produceTaskDelete(data) {
return request('delete', data)
},
// 获取生产任务单详情
produceTaskDetail(data) {
return request('detail', data, 'get')
}
}

View File

@ -0,0 +1,401 @@
<template>
<a-modal
v-model:open="visible"
title="用户选择"
:width="1000"
:mask-closable="false"
:destroy-on-close="true"
@ok="handleOk"
@cancel="handleClose"
>
<a-row :gutter="10">
<a-col :span="7">
<a-card size="small" :loading="cardLoading" class="selectorTreeDiv">
<a-tree
v-if="treeData"
v-model:expandedKeys="defaultExpandedKeys"
:tree-data="treeData"
:field-names="treeFieldNames"
@select="treeSelect"
>
</a-tree>
</a-card>
</a-col>
<a-col :span="11">
<div class="table-operator xn-mb10">
<a-form ref="searchFormRef" name="advanced_search" class="ant-advanced-search-form" :model="searchFormState">
<a-row :gutter="24">
<a-col :span="12">
<a-form-item name="searchKey">
<a-input v-model:value="searchFormState.searchKey" placeholder="请输入用户名" />
</a-form-item>
</a-col>
<a-col :span="12">
<a-button type="primary" class="primarySele" @click="loadData()"> </a-button>
<a-button class="snowy-button-left" @click="reset()"> </a-button>
</a-col>
</a-row>
</a-form>
</div>
<div class="user-table">
<a-table
ref="tableRef"
size="small"
:columns="commons"
:data-source="tableData"
:expand-row-by-click="true"
:loading="pageLoading"
bordered
:pagination="false"
>
<template #title>
<span>待选择列表 {{ tableRecordNum }} </span>
<div v-if="!radioModel" class="xn-fdr">
<a-button type="dashed" size="small" @click="addAllPageRecord"></a-button>
</div>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'avatar'">
<a-avatar :src="record.avatar" style="margin-bottom: -5px; margin-top: -5px" />
</template>
<template v-if="column.dataIndex === 'action'">
<a-button type="dashed" size="small" @click="addRecord(record)"><PlusOutlined /></a-button>
</template>
<template v-if="column.dataIndex === 'category'">
{{ $TOOL.dictTypeData('ROLE_CATEGORY', record.category) }}
</template>
</template>
</a-table>
<div class="mt-2">
<a-pagination
v-if="!isEmpty(tableData)"
v-model:current="current"
v-model:page-size="pageSize"
:total="total"
size="small"
showSizeChanger
@change="paginationChange"
/>
</div>
</div>
</a-col>
<a-col :span="6">
<div class="user-table">
<a-table
ref="selectedTable"
size="small"
:columns="selectedCommons"
:data-source="selectedData"
:expand-row-by-click="true"
:loading="selectedTableListLoading"
bordered
>
<template #title>
<span>已选择: {{ selectedData.length }}</span>
<div v-if="!radioModel" class="xn-fdr">
<a-button type="dashed" danger size="small" @click="delAllRecord"></a-button>
</div>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'action'">
<a-button type="dashed" danger size="small" @click="delRecord(record)"><MinusOutlined /></a-button>
</template>
</template>
</a-table>
</div>
</a-col>
</a-row>
</a-modal>
</template>
<script setup name="employeeSelectorPlus">
import { message } from 'ant-design-vue'
import { remove, isEmpty } from 'lodash-es'
//
const visible = ref(false)
// common
const commons = [
{
title: '操作',
dataIndex: 'action',
align: 'center',
width: 50
},
{
title: '姓名',
dataIndex: 'name',
ellipsis: true
},
{
title: '身份证号码',
dataIndex: 'idNumber'
},
{
title: '手机号码',
dataIndex: 'phone'
}
]
// common
const selectedCommons = [
{
title: '操作',
dataIndex: 'action',
align: 'center',
width: 50
},
{
title: '用户名',
dataIndex: 'name',
ellipsis: true
}
]
// ref
const tableRef = ref()
// ref
const selectedTable = ref()
const tableRecordNum = ref()
const searchFormState = ref({})
const searchFormRef = ref()
const cardLoading = ref(true)
const pageLoading = ref(false)
const selectedTableListLoading = ref(false)
// treeNode title,key,children
const treeFieldNames = { children: 'children', title: 'name', key: 'id' }
//
const treeData = ref()
// id
const defaultExpandedKeys = ref([])
const emit = defineEmits({ onBack: null })
const tableData = ref([])
const selectedData = ref([])
const recordIds = ref()
const props = defineProps(['radioModel', 'dataIsConverterFlw', 'orgTreeApi', 'userPageApi', 'checkedUserListApi'])
//
const radioModel = props.radioModel || false
//
const dataIsConverterFlw = props.dataIsConverterFlw || false
//
const current = ref(0) //
const pageSize = ref(20) //
const total = ref(0) //
//
const showUserPlusModal = (ids = []) => {
visible.value = true
if (dataIsConverterFlw) {
ids = goDataConverter(ids)
}
console.log(ids, 'ids')
recordIds.value = ids
//
if (props.orgTreeApi) {
//
props.orgTreeApi().then((data) => {
cardLoading.value = false
if (data !== null) {
treeData.value = data
// 2
treeData.value.forEach((item) => {
// 0
if (item.parentId === '0') {
defaultExpandedKeys.value.push(item.id)
// ID
if (item.children) {
item.children.forEach((items) => {
defaultExpandedKeys.value.push(items.id)
})
}
}
})
}
})
}
searchFormState.value.size = pageSize.value
loadData()
if (props.checkedUserListApi) {
console.log(recordIds.value)
if (isEmpty(recordIds.value)) {
return
}
const param = {
idList: recordIds.value
}
selectedTableListLoading.value = true
props
.checkedUserListApi(param)
.then((data) => {
selectedData.value = data
})
.finally(() => {
selectedTableListLoading.value = false
})
}
}
//
const loadData = () => {
pageLoading.value = true
props
.userPageApi(searchFormState.value)
.then((data) => {
current.value = data.current
// pageSize.value = data.size
total.value = data.total
//
tableData.value = []
tableRecordNum.value = 0
tableData.value = data.records
if (data.records) {
tableRecordNum.value = data.records.length
} else {
tableRecordNum.value = 0
}
})
.finally(() => {
pageLoading.value = false
})
}
// pageSize
const paginationChange = (page, pageSize) => {
searchFormState.value.current = page
searchFormState.value.size = pageSize
loadData()
}
const judge = () => {
return !(radioModel && selectedData.value.length > 0)
}
//
const addRecord = (record) => {
if (!judge()) {
message.warning('只可选择一条')
return
}
const selectedRecord = selectedData.value.filter((item) => item.id === record.id)
if (selectedRecord.length === 0) {
selectedData.value.push(record)
} else {
message.warning('该记录已存在')
}
}
//
const addAllPageRecord = () => {
let newArray = selectedData.value.concat(tableData.value)
let list = []
for (let item1 of newArray) {
let flag = true
for (let item2 of list) {
if (item1.id === item2.id) {
flag = false
}
}
if (flag) {
list.push(item1)
}
}
selectedData.value = list
}
//
const delRecord = (record) => {
remove(selectedData.value, (item) => item.id === record.id)
}
//
const delAllRecord = () => {
selectedData.value = []
}
//
const treeSelect = (selectedKeys) => {
searchFormState.value.current = 0
if (selectedKeys.length > 0) {
searchFormState.value.categoryId = selectedKeys.toString()
} else {
delete searchFormState.value.categoryId
}
loadData()
}
//
const handleOk = () => {
const value = []
selectedData.value.forEach((item) => {
value.push(item)
})
//
if (dataIsConverterFlw) {
emit('onBack', outDataConverter(value))
} else {
emit('onBack', value)
}
handleClose()
}
//
const reset = () => {
delete searchFormState.value.searchKey
loadData()
}
const handleClose = () => {
searchFormState.value = {}
tableRecordNum.value = 0
tableData.value = []
current.value = 0
pageSize.value = 20
total.value = 0
selectedData.value = []
visible.value = false
}
//
const goDataConverter = (data) => {
const resultData = []
if (data.length > 0) {
const values = data[0].value.split(',')
if (JSON.stringify(values) !== '[""]') {
for (let i = 0; i < values.length; i++) {
resultData.push(values[i])
}
}
}
return resultData
}
//
const outDataConverter = (data) => {
const obj = {}
let label = ''
let value = ''
for (let i = 0; i < data.length; i++) {
if (data.length === i + 1) {
label = label + data[i].name
value = value + data[i].id
} else {
label = label + data[i].name + ','
value = value + data[i].id + ','
}
}
obj.key = 'USER'
obj.label = label
obj.value = value
obj.extJson = ''
return obj
}
defineExpose({
showUserPlusModal
})
</script>
<style lang="less" scoped>
.selectorTreeDiv {
max-height: 500px;
overflow: auto;
}
.cardTag {
margin-left: 10px;
}
.primarySele {
margin-right: 10px;
}
.ant-form-item {
margin-bottom: 0 !important;
}
.user-table {
overflow: auto;
max-height: 450px;
}
</style>

View File

@ -0,0 +1,221 @@
<template>
<div></div>
<a-modal v-model:open="visible" title="生产线选择" width="80%" @ok="handleOk" @cancel="handleClose">
<a-form ref="searchFormRef" name="advanced_search" :model="searchFormState" class="ant-advanced-search-form">
<a-row :gutter="24">
<a-col :span="6">
<a-form-item label="名称" name="name">
<a-input v-model:value="searchFormState.name" placeholder="请输入名称" />
</a-form-item>
</a-col>
<a-col :span="6">
<a-form-item label="编码" name="number">
<a-input v-model:value="searchFormState.number" placeholder="请输入编码" />
</a-form-item>
</a-col>
<a-col :span="6">
<a-form-item label="可用状态" name="enabledState">
<a-select
v-model:value="searchFormState.enabledState"
placeholder="请选择可用状态"
:options="$TOOL.dictList('COMMON_STATUS')"
/>
</a-form-item>
</a-col>
<a-col :span="6">
<a-button type="primary" @click="tableRef.refresh()"></a-button>
<a-button style="margin: 0 8px" @click="reset"></a-button>
</a-col>
</a-row>
</a-form>
<a-row :gutter="24">
<a-col :span="6">
<dynamic-tree
ref="dynamicTreeRef"
treeTitle="生产组织"
:tableRef="tableRef"
:apiModel="{
getTree: productionOrganizationApi.productionOrganizationTree,
delTree: productionOrganizationApi.productionOrganizationDelete
}"
@selectTree="onSelectTree"
@treeRefresh="treeRefresh"
:toolConfig="{
plus: false,
edit: false,
delete: false,
refresh: true
}"
></dynamic-tree>
</a-col>
<a-col :span="18">
<s-table
ref="tableRef"
:columns="columns"
:data="loadData"
:alert="options.alert.show"
bordered
:row-key="(record) => record.id"
:tool-config="options.toolConfig"
:row-selection="tableRowSelection"
:scroll="{
x: 100
}"
>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'number'">
<a href="#">{{ record.number }}</a>
</template>
<template v-if="column.dataIndex === 'enabledState'">
<a-tag color="#87d068" v-if="record.enabledState === 'ENABLE'"></a-tag>
<a-tag color="#f50" v-if="record.enabledState === 'DISABLED'"></a-tag>
</template>
<template v-if="column.dataIndex === 'type'">
{{ $TOOL.dictTypeData('PRODUCTION_ORGANIZATION_TYPE', record.type) }}
</template>
</template>
</s-table>
</a-col>
</a-row>
</a-modal>
</template>
<script setup>
import { useTableManagement } from '@/hook/useTableManagement'
import { message } from 'ant-design-vue'
import productionOrganizationApi from '@/api/base/production-organization/productionOrganizationApi'
const publicAccountColumn = [
{
title: '编码',
dataIndex: 'number',
sorter: true,
sortDirections: ['descend', 'ascend'],
align: 'center',
resizable: true,
width: 300,
ellipsis: true
},
{
title: '类型',
dataIndex: 'type',
align: 'center',
resizable: true,
width: 100
},
{
title: '名称',
dataIndex: 'name',
align: 'center',
resizable: true,
width: 300,
ellipsis: true
},
{
title: '可用状态',
dataIndex: 'enabledState',
align: 'center',
resizable: true,
width: 100,
ellipsis: true
},
{
title: '创建时间',
dataIndex: 'createTime',
sorter: true,
sortDirections: ['descend', 'ascend'],
align: 'center',
resizable: true,
width: 300,
ellipsis: true
}
]
const emits = defineEmits(['ok'])
//
const visible = ref(false)
// 线
const dynamicTreeRef = ref(null)
//
const { searchFormState, tableRef, columns, loadData, reset, options, searchFormRef } = useTableManagement(
{
page: productionOrganizationApi.productionOrganizationPage,
delete: productionOrganizationApi.productionOrganizationDelete
},
publicAccountColumn,
[],
false
)
//
let treeValue = ref({})
const onSelectTree = (value) => {
treeValue.value = value
searchFormState.value.parentId = value.id
tableRef.value.refresh()
}
//
const treeRefresh = () => {
searchFormState.value.parentId = null
tableRef.value.refresh()
}
// 线
let tissueSelectedRowKey = []
let tissueSelectedRows = []
const tableRowSelection = {
type: 'radio',
onChange: (selectedRowKey, selectedRows) => {
tissueSelectedRowKey = selectedRowKey
tissueSelectedRows = selectedRows
}
}
//
const handleOk = () => {
if (tissueSelectedRowKey.length === 0) return message.error('请选择生产线')
if (tissueSelectedRows[0].type !== 'LINE') return message.error('请选择产线')
emits('ok', {
tissueSelectedRowKey,
tissueSelectedRows
})
closeModal()
}
//
const handleClose = () => {
closeModal()
}
//
const closeModal = () => {
//
visible.value = false
// table
tableRef.value.clearSelected()
}
//
const showOpen = () => {
visible.value = true
nextTick(() => {
// 线
dynamicTreeRef.value.loadTreeData()
//
tableRef.value.refresh()
})
}
//
defineExpose({
showOpen
})
</script>
<style scoped></style>

View File

@ -0,0 +1,177 @@
<template>
<div></div>
<a-modal v-model:open="visible" title="物料选择" width="80%" @ok="handleOk" @cancel="handleClose">
<a-form ref="searchFormRef" name="advanced_search" :model="searchFormState" class="ant-advanced-search-form">
<a-row :gutter="24">
<a-col :span="6">
<a-form-item label="名称" name="name">
<a-input v-model:value="searchFormState.name" placeholder="请输入名称" />
</a-form-item>
</a-col>
<a-col :span="6">
<a-form-item label="编码" name="number">
<a-input v-model:value="searchFormState.number" placeholder="请输入编码" />
</a-form-item>
</a-col>
<a-col :span="6">
<a-form-item label="可用状态" name="enabledState">
<a-select
v-model:value="searchFormState.enabledState"
placeholder="请选择可用状态"
:options="$TOOL.dictList('COMMON_STATUS')"
/>
</a-form-item>
</a-col>
<a-col :span="6">
<a-button type="primary" @click="tableRef.refresh()"></a-button>
<a-button style="margin: 0 8px" @click="reset"></a-button>
</a-col>
</a-row>
</a-form>
<a-row :gutter="24">
<a-col :span="6">
<dynamic-tree
ref="dynamicTreeRef"
treeTitle="物料分类"
:tableRef="tableRef"
:apiModel="{
getTree: materialCategoryApi.materialCategoryTree,
delTree: materialCategoryApi.materialCategoryDelete
}"
@selectTree="selectTree"
@treeRefresh="treeRefresh"
:toolConfig="{
plus: false,
edit: false,
delete: false,
refresh: true
}"
></dynamic-tree>
</a-col>
<a-col :span="18">
<s-table
ref="tableRef"
:columns="columns"
:data="loadData"
:alert="options.alert.show"
bordered
:row-key="(record) => record.id"
:tool-config="options.toolConfig"
:row-selection="tableRowSelection"
:scroll="{
x: 100,
y: 500
}"
>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'number'">
<a href="#">{{ record.number }}</a>
</template>
<template v-if="column.dataIndex === 'enabledState'">
<a-tag color="#87d068" v-if="record.enabledState === 'ENABLE'"></a-tag>
<a-tag color="#f50" v-if="record.enabledState === 'DISABLED'"></a-tag>
</template>
<template v-if="column.dataIndex === 'type'">
{{ $TOOL.dictTypeData('OFFICIAL_ACCOUNT_TYPE', record.type) }}
</template>
</template>
</s-table>
</a-col>
</a-row>
</a-modal>
</template>
<script setup>
import { useTableManagement } from '@/hook/useTableManagement'
import materialApi from '@/api/base/material/materialApi'
import { materielColumn } from '@/views/productionBusiness/basicData/materiel/column/materiel-column'
import materialCategoryApi from '@/api/base/material/materialCategoryApi'
import { message } from 'ant-design-vue'
const emits = defineEmits(['ok'])
//
const visible = ref(false)
//
const dynamicTreeRef = ref(null)
//
const { searchFormState, tableRef, selectedRowKeys, columns, loadData, reset, options, searchFormRef } =
useTableManagement(
{
page: materialApi.materialPage,
delete: materialApi.materialDelete
},
materielColumn,
[],
false
)
//
const selectTree = (value) => {
searchFormState.value.categoryId = value.id
tableRef.value.refresh()
}
//
const treeRefresh = () => {
searchFormState.value.categoryId = null
tableRef.value.refresh()
}
//
let materielSelectedRowKey = []
let materielSelectedRows = []
const tableRowSelection = {
type: 'radio',
onChange: (selectedRowKey, selectedRows) => {
materielSelectedRowKey = selectedRowKey
materielSelectedRows = selectedRows
}
}
//
const handleOk = () => {
if (materielSelectedRowKey.length === 0) return message.error('请选择物料')
emits('ok', {
materielSelectedRowKey,
materielSelectedRows
})
closeModal()
}
//
const handleClose = () => {
closeModal()
}
//
const closeModal = () => {
//
visible.value = false
// table
tableRef.value.clearSelected()
}
//
const showOpen = () => {
visible.value = true
nextTick(() => {
//
dynamicTreeRef.value.loadTreeData()
//
tableRef.value.refresh()
})
}
//
defineExpose({
showOpen
})
</script>
<style scoped></style>

View File

@ -167,7 +167,7 @@
import { get } from 'lodash-es'
const slots = useSlots()
const route = useRoute()
const emit = defineEmits(['expand', 'plusRowData', 'editRowData', 'deleteRowData'])
const emit = defineEmits(['expand', 'plusRowData', 'editRowData', 'deleteRowData', 'refresh'])
const renderSlots = Object.keys(slots)
const props = defineProps(
@ -347,6 +347,7 @@
))
loadData()
getTableProps()
emit('refresh')
}
//
const changeRowClass = (v) => {

View File

@ -7,9 +7,10 @@ import extendFieldApi from '@/api/base/extendfield/extendFieldApi'
* 使用表单处理程序封装表单的提交初始化和回退逻辑
* @param {Array} formItems 表单项配置包含表单字段名默认值等信息
* @param {Object} api 包含表单提交和获取详情方法的对象
* @param backRouter
* @returns {Object} 返回包含表单数据提交加载状态表单引用提交函数等的对象
*/
export default function useFormHandler(formItems, api) {
export default function useFormHandler(formItems, api, backRouter) {
// 初始化页面类型状态
const state = reactive({
PAGE_TYPE: ''
@ -68,7 +69,7 @@ export default function useFormHandler(formItems, api) {
// 调用api提交表单数据
await api.submitForm(formDataParam, safeId)
// 提交成功后返回上一页,并关闭当前标签页
handleBack()
handleBack(backRouter)
} catch (error) {
console.error('Validation error:', error)
} finally {
@ -92,9 +93,9 @@ export default function useFormHandler(formItems, api) {
/**
* 处理返回操作返回上一级页面并关闭当前标签页
*/
const handleBack = () => {
const handleBack = (routerPath) => {
// useTabs.close(route)
router.push('/basicData/publicAccount') // 优化为通用的返回上一页操作
useTabs.close('', routerPath)
}
/**
@ -148,6 +149,7 @@ export default function useFormHandler(formItems, api) {
if (resExtendField) {
resExtendField.forEach((item) => {
if (item.showValues) {
const showValues = JSON.parse(item.showValues)
let options = []
showValues.forEach((value) => {
@ -166,6 +168,7 @@ export default function useFormHandler(formItems, api) {
options
}
})
}
})
extendData.forEach((item) => {

View File

@ -7,10 +7,11 @@ import useTabs from '@/utils/useTabs'
* 列表页面表格信息 hook 封装数据操作
* @param apiModule 调用接口
* @param tableColumns 表格头部信息
* @param hasPermData
* @param hasPermData 权限控制
* @param isShowAction 是否在列首添加列
* @returns {{searchFormRef: Ref<UnwrapRef<{}>>, toolConfig: {columnSetting: boolean, striped: boolean, refresh: boolean, height: boolean}, searchFormState: Ref<UnwrapRef<{}>>, tableRef: Ref<UnwrapRef<null>>, selectedRowKeys: Ref<UnwrapRef<*[]>>, columns: Ref<UnwrapRef<unknown>>, options: {rowSelection: {onChange: options.rowSelection.onChange}, alert: {show: boolean, clear: options.alert.clear}}, reset: reset, loadData: (function(*): *), deleteBatchRecords: deleteBatchRecords, deleteRecord: deleteRecord}}
*/
export function useTableManagement(apiModule = {}, tableColumns, hasPermData) {
export function useTableManagement(apiModule = {}, tableColumns, hasPermData, isShowAction = true) {
const searchFormState = ref({})
const searchFormRef = ref(null)
const selectedRowKeys = ref([])
@ -43,7 +44,7 @@ export function useTableManagement(apiModule = {}, tableColumns, hasPermData) {
if (hasPerm(hasPermData)) {
// 判断columns 是否有操作
const columnsFilter = columns.value.filter((item) => item.dataIndex === 'action')
if (columnsFilter.length === 0)
if (columnsFilter.length === 0 && isShowAction)
columns.value.unshift({
title: '操作',
dataIndex: 'action',

View File

@ -319,7 +319,9 @@
background: none;
height: 40px;
line-height: 40px;
transition: background-color 0.3s, color 0.3s;
transition:
background-color 0.3s,
color 0.3s;
padding: 0 16px;
border-radius: 0;
border: none;
@ -440,7 +442,9 @@
position: relative;
z-index: 1;
border-radius: 10px 10px 0 0 !important;
box-shadow: 12px 15px 0 0 var(--primary-1), -12px 15px 0 0 var(--primary-1);
box-shadow:
12px 15px 0 0 var(--primary-1),
-12px 15px 0 0 var(--primary-1);
}
.snowy-radius .ant-tabs-tab-active::before {
content: '';

View File

@ -18,7 +18,7 @@ export const viewTagsStore = defineStore('viewTags', () => {
const pushViewTags = (route) => {
const target = viewTags.value.find((item) => item.path === route.path)
const isName = route.name
if (!target) {
if (!target && isName) {
viewTags.value.push(route)
}
if (target) {

View File

@ -36,7 +36,6 @@ export default {
keepAliveStore().removeKeepLive(route.name)
const tagList = store.viewTags
const latestView = tagList.slice(-1)[0]
console.log(latestView, 'route')
if (latestView) {
router.push(latestView)
} else {

View File

@ -40,8 +40,7 @@
:tool-config="options.toolConfig"
:row-selection="options.rowSelection"
:scroll="{
x: 100,
x: 100
}"
>
<template #operator>

View File

@ -142,12 +142,14 @@
let cityOptionsCounty = ref([])
const onChangeProvince = (value, options) => {
console.log(options)
cityOptionsCity.value = options.children
formData.city = null
formData.county = null
}
const onChangeCity = (value, options) => {
cityOptionsCounty.value = options.children
formData.county = null
}
const filterOption = (input, option) => {
@ -253,7 +255,7 @@
isUseSlot: true,
slotName: 'countySlot',
span: 8,
rules: [required('请选择区')],
rules: [required('请选择区')]
},
{
name: 'address',
@ -390,7 +392,6 @@
}
onMounted(async () => {
console.log(1)
formRefs.value = [formRef1.value, formRef2.value]
fetchData(route.query.type).then((res) => {
if (res) {
@ -431,6 +432,8 @@
}
})
})
//
})
let activeKey = ref('1')

View File

@ -33,13 +33,13 @@ export const materielColumn = [
width: 150,
ellipsis: true
},
// {
// title: '分类',
// dataIndex: 'name',
// align: 'center',
// resizable: true,
// width: 150
// },
{
title: '分类',
dataIndex: 'categoryName',
align: 'center',
resizable: true,
width: 150
},
{
title: '品牌',
dataIndex: 'brandName',

View File

@ -26,7 +26,16 @@
ref="formRef2"
/>
</a-tab-pane>
<a-tab-pane key="2" tab="单位信息" forceRender>
<a-tab-pane key="2" tab="价格体系" forceRender>
<DynamicForm
:allDisabled="route.query.type === 'SEARCH'"
:formItems="priceFormItems"
:model="formData"
:rules="formRules"
ref="formRef4"
/>
</a-tab-pane>
<a-tab-pane key="3" tab="单位信息" forceRender>
<DynamicForm
:allDisabled="route.query.type === 'SEARCH'"
:formItems="unitFormItems"
@ -35,9 +44,9 @@
ref="formRef3"
/>
</a-tab-pane>
<a-tab-pane key="3" tab="包装关系" forceRender>
<a-table :dataSource="dataSource" :columns="columns">
<template #bodyCell="{ column, record }">
<a-tab-pane key="4" tab="包装关系" forceRender>
<a-table :dataSource="dataSource" :columns="columns" :pagination="false">
<template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'enabledState'">
<a-switch
:disabled="route.query.type === 'SEARCH'"
@ -50,7 +59,7 @@
</template>
<template v-if="column.dataIndex === 'unitId'">
<a-select
:disabled="route.query.type === 'SEARCH'"
:disabled="route.query.type === 'SEARCH' || index === 0"
style="width: 100%"
placeholder="请选择单位"
v-model:value="record.unitId"
@ -60,7 +69,11 @@
value: 'id'
}"
allowClear
@change="onChangeUnit"
@change="
(value, options) => {
onChangeUnit(value, options, record)
}
"
/>
</template>
<template v-if="column.dataIndex === 'productQty'">
@ -73,10 +86,13 @@
<template v-if="column.dataIndex === 'name'">
<a-input :disabled="route.query.type === 'SEARCH'" v-model:value="record.name" />
</template>
<template v-if="column.dataIndex === 'rate'">
<a-input disabled v-model:value="record.rate" />
</template>
</template>
</a-table>
</a-tab-pane>
<a-tab-pane key="4" tab="商品推广" forceRender>
<a-tab-pane key="5" tab="商品推广" forceRender>
<a-form :model="productFormData" class="w-1/3" layout="vertical">
<a-form-item label="是否启用" name="promoteEnabledState">
<a-select
@ -108,7 +124,7 @@
</a-form-item>
</a-form>
</a-tab-pane>
<a-tab-pane key="5" tab="扩展字段" forceRender v-if="extendData.length > 0">
<a-tab-pane key="6" tab="扩展字段" forceRender v-if="extendData.length > 0">
<DynamicForm
:allDisabled="route.query.type === 'SEARCH'"
:formItems="extendData"
@ -119,9 +135,12 @@
<a-empty v-else />
</a-tab-pane>
<a-tab-pane key="6" tab="操作信息" v-if="route.query.type !== 'ADD'">
<a-tab-pane key="7" tab="操作信息" v-if="route.query.type !== 'ADD'">
<OperationalInformation :detailData="inform" :colSpan="6"></OperationalInformation>
</a-tab-pane>
<template #rightExtra v-if="activeKey === '3'">
<a-button @click="handleCompute"></a-button>
</template>
</a-tabs>
</a-card>
</template>
@ -138,11 +157,14 @@
import materialCategoryApi from '@/api/base/material/materialCategoryApi'
import { message } from 'ant-design-vue'
import sysBrandApi from '@/api/base/brand/sysBrandApi'
import { notification } from 'ant-design-vue'
const route = useRoute()
const formRef1 = ref(null)
const formRef2 = ref(null)
const formRef3 = ref(null)
const formRef4 = ref(null)
let dataSource = ref([])
let unitOptions = reactive([])
@ -152,7 +174,7 @@
let extendData = ref([]) //
onMounted(async () => {
formRefs.value = [formRef1.value, formRef2.value, formRef3.value]
formRefs.value = [formRef1.value, formRef2.value, formRef3.value, formRef4.value]
fetchData(route.query.type).then(async (res) => {
if (res) {
productFormData.value.promoteEnabledState = res.promoteEnabledState
@ -182,7 +204,7 @@
const packageType = tool.dictList('MATERIAL_PACKAGE_TYPE')
packageType.forEach((item) => {
dataSource.value.push({
enabledState: 'ENABLE',
enabledState: 'DISABLE',
number: item.value,
type: item.label,
name: item.label,
@ -255,6 +277,11 @@
unitOptions = res
const resFilter = res.filter((item) => item.isBase === 'YES')
if (resFilter.length > 0) formData.baseUnitId = resFilter[0].id
//
dataSource.value[0].unitId = resFilter[0].id
dataSource.value[0].productQty = null
dataSource.value[0].rate = resFilter[0].rate
})
}
@ -269,7 +296,6 @@
}
//
function getBase64(img, callback) {
const reader = new FileReader()
reader.addEventListener('load', () => callback(reader.result))
@ -341,7 +367,7 @@
type: 'a-input',
span: 6,
attrs: {
placeholder: '请输入称',
placeholder: '请输入称',
allowClear: true
}
},
@ -351,7 +377,7 @@
type: 'a-input',
span: 6,
attrs: {
placeholder: '请输入',
placeholder: '请输入名',
allowClear: true
}
},
@ -361,7 +387,7 @@
type: 'a-input',
span: 6,
attrs: {
placeholder: '请输入名称',
placeholder: '请输入规格型号',
allowClear: true
}
},
@ -370,9 +396,11 @@
name: 'packageProportion',
type: 'a-input',
span: 6,
rules: [required('请输入包装比例')],
attrs: {
placeholder: '请输入名称',
allowClear: true
placeholder: '请输入包装比例',
allowClear: true,
disabled: true
}
},
{
@ -381,7 +409,7 @@
type: 'a-input',
span: 6,
attrs: {
placeholder: '请输入名称',
placeholder: '请输入助记码',
allowClear: true
}
},
@ -632,52 +660,149 @@
}
])
const priceFormItems = [
{
label: '生产价格:',
name: 'producePrice',
type: 'a-input',
span: 6,
rules: [required('请输入生产价格')],
attrs: {
placeholder: '请输入生产价格'
}
},
{
label: '采购价格:',
name: 'purchasePrice',
type: 'a-input-number',
span: 6,
rules: [required('请输入采购价格')],
attrs: {
placeholder: '请输入生产价格'
}
},
{
label: '统一零售价:',
name: 'retailPrice',
type: 'a-input-number',
span: 6,
rules: [required('请输入统一零售价')],
attrs: {
placeholder: '请输入生产价格'
}
}
]
const columns = [
{
title: '启用',
dataIndex: 'enabledState',
editable: true,
align: 'center'
align: 'center',
width: 100
},
{
title: '条码类型编码',
dataIndex: 'number',
editable: true,
align: 'center'
align: 'center',
width: 200
},
{
title: '条码类型',
dataIndex: 'type',
editable: true,
align: 'center'
align: 'center',
width: 200
},
{
title: '包装关系名称',
dataIndex: 'name',
editable: true,
align: 'center'
align: 'center',
width: 200
},
{
title: '单位',
dataIndex: 'unitId',
editable: true,
align: 'center'
align: 'center',
width: 200
},
{
title: '换算率',
dataIndex: 'rate',
editable: true,
align: 'center',
width: 200
},
{
title: '产品数',
dataIndex: 'productQty',
editable: true,
align: 'center'
align: 'center',
width: 200
}
]
const onChangeUnit = (value) => {
const unitIdList = new Set(dataSource.value.map((item) => item.unitId))
const [api, contextHolder] = notification.useNotification()
const onChangeUnit = (value, options, record) => {
record.rate = options.rate
}
// unitOptions disabled
unitOptions.forEach((item) => {
item.disabled = unitIdList.has(item.id)
const handleCompute = () => {
const enabledStateFilter = dataSource.value.filter((item) => item.enabledState === 'ENABLE')
if (enabledStateFilter.length === 0)
return notification.error({
message: `包装比例转换提示`,
description: '当前暂无启用的包装关系,请选择要启用的包装关系'
})
if (enabledStateFilter.length > 0) {
//
for (let i = 0; i < enabledStateFilter.length; i++) {
if (!enabledStateFilter[i].unitId || !enabledStateFilter[i].productQty)
return notification.error({
message: `包装比例转换提示`,
description: `已启用的条码类型编码${enabledStateFilter[i].number},单位或产品数不能为空`
})
}
//
for (let i = 0; i < enabledStateFilter.length - 1; i++) {
//
if (enabledStateFilter[i].rate > enabledStateFilter[i + 1].rate) {
//
return notification.error({
message: `包装比例转换提示`,
description: `${enabledStateFilter[i + 1].number}的换算率不能小于或等于${
enabledStateFilter[i].number
}的换算率`
})
}
}
let packageProportionCount = []
enabledStateFilter.forEach((item) => {
packageProportionCount.push(item.productQty * item.rate)
})
formData.packageProportion = calculateRatios(packageProportionCount).join(':')
}
}
function calculateRatios(arr) {
//
const ratios = []
//
ratios.push(arr[arr.length - 1] / arr[arr.length - 1])
//
for (let i = arr.length - 1; i > 0; i--) {
ratios.push(arr[i] / arr[i - 1])
}
return ratios
}
const { formData, formRefs, inform, extendFormData, onSubmit, handleBack, fetchData, getExtendField } =

View File

@ -57,7 +57,7 @@
:tool-config="options.toolConfig"
:row-selection="options.rowSelection"
:scroll="{
x: 100,
x: 100
}"
>
<template #operator class="table-operator">
@ -139,6 +139,7 @@
</a-col>
</a-row>
</a-card>
<material-category-form ref="materialCategoryFormRef" @successful="successful"></material-category-form>
</template>

View File

@ -54,10 +54,7 @@
let recordData = cloneDeep(record)
formData.value = Object.assign({}, recordData)
} else {
formData.value.number = ''
formData.value.name = ''
formData.value.enabledState = 'ENABLE'
formData.id = ''
formData.value = { name: '', number: '', enabledState: 'ENABLE' }
}
}
//

View File

@ -1,5 +1,5 @@
<template>
<a-page-header style="padding: 10px; font-size: 20px" @back="handleBack">
<a-page-header style="padding: 10px; font-size: 20px" @back="handleBack('/basicData/unit')">
<template #extra>
<a-button key="1" type="primary" @click="onSubmitForm"></a-button>
</template>
@ -51,6 +51,7 @@
const formRules = {
unitGroupId: [required('请选择单位')],
name: [required('请输入名称')],
rate: [required('请输入换算率')],
isBase: [required('请选择是否基本单位')]
}
@ -126,7 +127,9 @@
span: 6,
attrs: {
placeholder: '请输入换算率',
allowClear: true
allowClear: true,
min: 1,
precision: 0
}
},
{
@ -164,8 +167,12 @@
])
const { formData, formRefs, inform, extendFormData, onSubmit, handleBack, fetchData, getExtendField } =
useFormHandler([...unitFormItems], {
useFormHandler(
[...unitFormItems],
{
submitForm: unitApi.sysUnitSubmitForm,
getDetail: unitApi.sysUnitDetail
})
},
'/basicData/unit'
)
</script>

View File

@ -56,6 +56,7 @@
@plusRowData="handlePlusRowData"
@editRowData="handleEditRowData"
@deleteRowData="handleDeleteRowData"
@refresh="handleRefresh"
:rowSelection="unitGroupRowSelection"
>
<template #operator class="table-operator">
@ -265,6 +266,10 @@
})
}
const handleRefresh = () => {
unitGroupTableRef.value.clearSelected()
}
const successful = () => {
searchFormState.value.unitGroupId = ''
tableRef.value.refresh()

View File

@ -0,0 +1,229 @@
<template>
<a-page-header style="padding: 10px; font-size: 20px" @back="handleBack">
<template #extra>
<a-button v-if="route.query.type !== 'SEARCH'" key="1" type="primary" @click="onSubmitForm"></a-button>
</template>
</a-page-header>
<a-card :bordered="false" title="品牌">
<DynamicForm
:allDisabled="route.query.type === 'SEARCH'"
:formItems="baseFormItems"
:model="formData"
:rules="formRules"
ref="formRef1"
/>
</a-card>
<a-card
:bordered="false"
class="mt-4"
style="height: 100%"
v-if="route.query.type !== 'ADD' || extendData.length > 0"
>
<a-tabs v-model:activeKey="activeKey">
<a-tab-pane key="1" tab="扩展字段" forceRender v-if="extendData.length > 0">
<DynamicForm
:allDisabled="route.query.type === 'SEARCH'"
:formItems="extendData"
:model="extendFormData"
:rules="formRules"
v-if="extendData.length > 0"
/>
<a-empty v-else />
</a-tab-pane>
<a-tab-pane key="2" tab="操作信息" v-if="route.query.type !== 'ADD'">
<OperationalInformation :detailData="inform" :colSpan="6"></OperationalInformation>
</a-tab-pane>
</a-tabs>
</a-card>
</template>
<script setup name="personnelDetail">
import { required } from '@/utils/formRules'
import employeeApi from '@/api/base/employee/employeeApi'
import useFormHandler from '@/hook/useFormHandler'
import tool from '@/utils/tool'
import { useRoute } from 'vue-router'
import employeeCategoryApi from '@/api/base/employee/employeeCategoryApi'
const route = useRoute()
const formRules = {
name: [required('请输入名称')],
type: [required('请输入类型')],
appid: [required('请输入AppID')],
secret: [required('请输入AppSecret')]
}
const baseFormItems = reactive([
{
label: '姓名:',
name: 'name',
type: 'a-input',
span: 6,
attrs: {
placeholder: '请输入名称',
allowClear: true
}
},
{
label: '性别:',
name: 'gender',
type: 'a-select',
span: 6,
attrs: {
placeholder: '请选择性别',
options: tool.dictList('GENDER')
}
},
{
label: '电话号码:',
name: 'phone',
type: 'a-input',
span: 6,
attrs: {
placeholder: '请输入电话号码',
allowClear: true
}
},
{
label: '支付卡号:',
name: 'payCard',
type: 'a-input',
span: 6,
attrs: {
placeholder: '请输入支付卡号',
allowClear: true
}
},
{
label: '支付银行:',
name: 'payBank',
type: 'a-input',
span: 6,
attrs: {
placeholder: '请输入支付银行',
allowClear: true
}
},
{
label: '是否合适:',
name: 'isFit',
type: 'a-select',
span: 6,
attrs: {
placeholder: '请选择是否合适',
options: tool.dictList('FIT_STATE')
}
},
{
label: '员工分类:',
name: 'categoryId',
type: 'a-tree-select',
span: 6,
attrs: {
placeholder: '请选择是否合适',
treeData: [],
fieldNames: {
children: 'children',
label: 'name',
value: 'id'
}
}
},
{
label: '启用状态:',
name: 'enabledState',
type: 'a-select',
span: 6,
attrs: {
placeholder: '请选择启用状态',
options: tool.dictList('COMMON_STATUS')
},
defaultValue: 'ENABLE'
},
{
label: '身份证号码:',
name: 'idNumber',
type: 'a-input',
span: 6,
attrs: {
placeholder: '请输入身份证号码',
allowClear: true
}
},
{
label: '年龄:',
name: 'age',
type: 'a-input-number',
span: 6,
attrs: {
placeholder: '请输入年龄',
allowClear: true
}
},
{
label: '入群:',
name: 'isJoinGroup',
type: 'a-select',
span: 6,
attrs: {
placeholder: '请选择是否合适',
options: tool.dictList('YES_NO')
}
},
{
label: '地址:',
name: 'contactAddress',
type: 'a-textarea',
span: 24,
attrs: {
placeholder: '请输入地址',
allowClear: true
}
},
{
label: '备注:',
name: 'remarks',
type: 'a-textarea',
span: 24,
attrs: {
placeholder: '请输入备注',
allowClear: true
}
}
])
const formRef1 = ref(null)
let extendData = ref([])
let { formData, formRefs, inform, extendFormData, onSubmit, handleBack, fetchData, getExtendField } = useFormHandler(
baseFormItems,
{
submitForm: employeeApi.employeeSubmitForm,
getDetail: employeeApi.employeeDetail
}
)
onMounted(async () => {
formRefs.value = [formRef1.value]
await fetchData(route.query.type)
employeeCategoryApi.employeeCategoryTree().then((res) => {
baseFormItems.forEach((item) => {
if (item.name === 'categoryId') {
item.attrs.treeData = res || []
}
})
})
extendData.value = await getExtendField('MATERIAL')
})
const onSubmitForm = async () => {
await onSubmit({ ...formData })
}
let activeKey = ref('1')
</script>

View File

@ -0,0 +1,125 @@
<template>
<xn-form-container
:title="pageType === 'EDIT' ? '编辑员工分类' : pageType === 'ADD' ? '增加员工分类' : '查看员工分类'"
:width="700"
:visible="visible"
:destroy-on-close="true"
@close="onClose"
>
<a-form ref="formRef" :model="formData" :rules="formRules" layout="vertical">
<a-row :gutter="16">
<a-col :span="24">
<a-form-item label="编码:" name="number">
<a-input
:disabled="pageType === 'SEARCH'"
v-model:value="formData.number"
placeholder="请输入编码"
allow-clear
/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="员工分类名称:" name="name">
<a-input
:disabled="pageType === 'SEARCH'"
v-model:value="formData.name"
placeholder="请输入员工分类名称"
allow-clear
/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="上级员工分类:" name="parentId">
<a-tree-select
:disabled="pageType === 'SEARCH'"
v-model:value="formData.parentId"
style="width: 100%"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
:tree-data="treeData"
placeholder="请选择上级员工分类"
:fieldNames="{
children: 'children',
label: 'name',
value: 'id'
}"
>
</a-tree-select>
</a-form-item>
</a-col>
</a-row>
</a-form>
<template #footer>
<a-button style="margin-right: 8px" @click="onClose"></a-button>
<a-button v-if="pageType !== 'SEARCH'" type="primary" @click="onSubmit" :loading="submitLoading"></a-button>
</template>
</xn-form-container>
</template>
<script setup name="productionOrganizationForm">
import { cloneDeep } from 'lodash-es'
import { required } from '@/utils/formRules'
import employeeCategoryApi from '@/api/base/employee/employeeCategoryApi'
//
const visible = ref(false)
const emit = defineEmits({ successful: null })
const formRef = ref()
//
let formData_enum = {
type: 'FACTORY',
enabledState: 'ENABLE'
}
const formData = ref({})
const submitLoading = ref(false)
let pageType = ref('ADD')
//
const onOpen = (record) => {
visible.value = true
if (record) {
pageType.value = record.pageType
let recordData = cloneDeep(record)
formData.value = Object.assign({}, recordData)
} else {
pageType.value = 'ADD'
formData.value = formData_enum
}
employeeCategoryApi.employeeCategoryTree().then((res) => {
treeData.value = res ? res : []
})
}
//
const onClose = () => {
formRef.value.resetFields()
visible.value = false
}
// refresh
const formRules = {
name: [required('请输入名称')],
parentId: [required('请选择上级员工分类')]
}
//
const onSubmit = () => {
formRef.value.validate().then(() => {
submitLoading.value = true
const formDataParam = cloneDeep(formData.value)
employeeCategoryApi
.employeeCategorySubmitForm(formDataParam, formDataParam.id)
.then(() => {
onClose()
emit('successful')
})
.finally(() => {
submitLoading.value = false
})
})
}
let treeData = ref([])
//
defineExpose({
onOpen
})
</script>

View File

@ -0,0 +1,201 @@
<template>
<a-card :bordered="false">
<a-form ref="searchFormRef" name="advanced_search" :model="searchFormState" class="ant-advanced-search-form">
<a-row :gutter="24">
<a-col :span="6">
<a-form-item label="名称" name="name">
<a-input v-model:value="searchFormState.name" placeholder="请输入名称" />
</a-form-item>
</a-col>
<a-col :span="6">
<a-form-item label="编码" name="number">
<a-input v-model:value="searchFormState.number" placeholder="请输入编码" />
</a-form-item>
</a-col>
<a-col :span="6">
<a-form-item label="可用状态" name="enabledState">
<a-select
v-model:value="searchFormState.enabledState"
placeholder="请选择可用状态"
:options="$TOOL.dictList('COMMON_STATUS')"
/>
</a-form-item>
</a-col>
<a-col :span="6">
<a-button type="primary" @click="tableRef.refresh()"></a-button>
<a-button style="margin: 0 8px" @click="reset"></a-button>
</a-col>
</a-row>
</a-form>
</a-card>
<a-card :bordered="false" class="mt-4" style="height: 100%">
<a-row :gutter="24">
<a-col :span="6">
<dynamic-tree
ref="dynamicTreeRef"
treeTitle="员工分类"
:tableRef="tableRef"
:openFormRef="personnelCategoryFormRef"
:apiModel="{
getTree: employeeCategoryApi.employeeCategoryTree,
delTree: employeeCategoryApi.employeeCategoryDelete
}"
@selectTree="selectTree"
@delTree="delTree"
@treeRefresh="treeRefresh"
></dynamic-tree>
</a-col>
<a-col :span="18">
<s-table
ref="tableRef"
:columns="columns"
:data="loadData"
:alert="options.alert.show"
bordered
:row-key="(record) => record.id"
:tool-config="options.toolConfig"
:row-selection="options.rowSelection"
:scroll="{
x: 100
}"
>
<template #operator>
<a-space>
<a-button
type="primary"
@click="
navigateTo('/employee/personnel/detail', {
type: 'ADD'
})
"
v-if="hasPerm('customerAdd')"
>
<template #icon><plus-outlined /></template>
新增
</a-button>
<xn-batch-delete
v-if="hasPerm('customerBatchDelete')"
:selectedRowKeys="selectedRowKeys"
@batchDelete="deleteBatchRecords"
/>
</a-space>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'number'">
<a href="#">{{ record.number }}</a>
</template>
<template v-if="column.dataIndex === 'enabledState'">
<a-tag color="#87d068" v-if="record.enabledState === 'ENABLE'"></a-tag>
<a-tag color="#f50" v-if="record.enabledState === 'DISABLED'"></a-tag>
</template>
<template v-if="column.dataIndex === 'type'">
{{ $TOOL.dictTypeData('OFFICIAL_ACCOUNT_TYPE', record.type) }}
</template>
<template v-if="column.dataIndex === 'action'">
<a-space>
<a-tooltip title="查看">
<a
@click="
navigateTo('/employee/personnel/detail', {
type: 'SEARCH',
id: record.id
})
"
v-if="hasPerm('customerEdit')"
>
<EyeOutlined />
<!-- 查看-->
</a>
</a-tooltip>
<a-divider type="vertical" v-if="hasPerm(['customerEdit', 'customerDelete'], 'and')" />
<a-tooltip title="查看">
<a
@click="
navigateTo('/employee/personnel/detail', {
type: 'EDIT',
id: record.id
})
"
v-if="hasPerm('customerEdit')"
>
<FormOutlined />
<!-- 编辑-->
</a>
</a-tooltip>
<a-divider type="vertical" v-if="hasPerm(['customerEdit', 'customerDelete'], 'and')" />
<a-popconfirm title="确定要删除吗?" @confirm="deleteRecord(record)">
<a-button type="link" danger size="small" v-if="hasPerm('customerDelete')">
<DeleteOutlined />
<!-- 删除-->
</a-button>
</a-popconfirm>
</a-space>
</template>
</template>
</s-table>
</a-col>
</a-row>
</a-card>
<personnel-category-form ref="personnelCategoryFormRef" @successful="successful"></personnel-category-form>
</template>
<script setup name="employee">
import employeeApi from '@/api/base/employee/employeeApi'
import employeeCategoryApi from '@/api/base/employee/employeeCategoryApi'
import { useTableManagement } from '@/hook/useTableManagement'
import { materielColumn } from '@/views/productionBusiness/basicData/materiel/column/materiel-column'
import PersonnelCategoryForm from '@/views/productionBusiness/employee/personnel/detail/personnelCategoryForm.vue'
const personnelCategoryFormRef = ref(null)
const dynamicTreeRef = ref(null)
const {
searchFormState,
tableRef,
selectedRowKeys,
columns,
loadData,
reset,
deleteRecord,
deleteBatchRecords,
options,
searchFormRef,
navigateTo
} = useTableManagement(
{
page: employeeApi.employeePage,
delete: employeeApi.employeeDelete
},
materielColumn,
['customerEdit', 'customerDelete']
)
const selectTree = (value) => {
searchFormState.value.categoryId = value.id
tableRef.value.refresh()
}
const treeRefresh = () => {
searchFormState.value.categoryId = null
tableRef.value.refresh()
}
const delTree = () => {
searchFormState.value.categoryId = null
tableRef.value.refresh()
}
const successful = () => {
searchFormState.value.categoryId = null
tableRef.value.refresh()
dynamicTreeRef.value.loadTreeData()
}
onMounted(() => {
dynamicTreeRef.value.loadTreeData()
})
</script>

View File

@ -0,0 +1,373 @@
<template>
<a-page-header style="padding: 10px; font-size: 20px" @back="handleBack('/basicData/unit')">
<template #extra>
<a-button key="1" type="primary" @click="onSubmitForm"></a-button>
</template>
</a-page-header>
<a-card :bordered="false" title="任务单信息">
<DynamicForm
:allDisabled="route.query.type === 'SEARCH'"
:formItems="basicInfoFormItems"
:model="formData"
:rules="formRules"
ref="formRef1"
>
<template #materialNameSlot="{ model, item }">
<a-input readonly v-bind="{ ...item.attrs }" v-model:value="model[item.name]" @click="openMateriel"></a-input>
</template>
<template #produceUnitNameSlot="{ model, item }">
<a-select v-bind="{ ...item.attrs }" v-model:value="model[item.name]" :options="unitList"></a-select>
</template>
<template #baseUnitNameSlot="{ model, item }">
<a-select v-bind="{ ...item.attrs }" v-model:value="model[item.name]" :options="unitList"></a-select>
</template>
<template #productionLineNameSlot="{ model, item }">
<a-input readonly v-bind="{ ...item.attrs }" v-model:value="model[item.name]" @click="openLine"></a-input>
</template>
</DynamicForm>
</a-card>
<a-card :bordered="false" class="mt-4">
<a-tabs v-model:activeKey="activeKey">
<a-tab-pane key="1" tab="人员信息">
<a-table :dataSource="dataSource" :columns="columns" :pagination="false">
<template #bodyCell="{ column, record, index }">
<template v-if="column.dataIndex === 'isFit'">
<a-select
:disabled="route.query.type === 'SEARCH'"
style="width: 100%"
placeholder="请选择是否合适"
v-model:value="record.isFit"
:options="tool.dictList('FIT_STATE')"
allowClear
/>
</template>
<template v-if="column.dataIndex === 'payMode'">
<a-select
:disabled="route.query.type === 'SEARCH'"
style="width: 100%"
placeholder="请选择支付方式"
v-model:value="record.payMode"
:options="tool.dictList('MANUAL_TASK_PAY_MODE')"
allowClear
/>
</template>
<template v-if="column.dataIndex === 'amount'">
<a-input-number
v-model:value="record.amount"
:min="0.01"
@change="amountChange($event, record)"
:precision="2"
/>
</template>
<template v-if="column.dataIndex === 'money'">
<a-input disabled v-model:value="record.money" :precision="2" />
</template>
</template>
</a-table>
</a-tab-pane>
<a-tab-pane key="3" tab="操作信息" v-if="route.query.type !== 'ADD'">
<OperationalInformation :detailData="inform" :colSpan="6"></OperationalInformation>
</a-tab-pane>
<template #rightExtra v-if="activeKey === '1'">
<a-space>
<a-button class="tabs-extra-demo-button" @click="handleOpenUser"></a-button>
<a-button class="tabs-extra-demo-button" @click="handleOpenAddUser"></a-button>
</a-space>
</template>
</a-tabs>
</a-card>
<materiel-selector-plus ref="materielSelectorPlusRef" @ok="materielBackOk"></materiel-selector-plus>
<line-selector-plus ref="lineSelectorPlusRef" @ok="lineBackOk"></line-selector-plus>
<employee-selector-plus
ref="userSelectorPlusProRef"
:org-tree-api="selectorApiFunction.orgTreeApi"
:user-page-api="selectorApiFunction.userPageApi"
:checkedUserListApi="selectorApiFunction.userListByIdListApi"
@onBack="userSelectorOnBack"
:radioModel="true"
></employee-selector-plus>
<personnel-form ref="personnelFormRef" @successful="successful"></personnel-form>
</template>
<script setup name="personnelReportDetail">
import employeeApi from '@/api/base/employee/employeeApi'
import employeeCategoryApi from '@/api/base/employee/employeeCategoryApi'
import manualTaskApi from '@/api/base/manual-task/manualTaskApi'
import MaterielSelectorPlus from '@/components/Selector/materielSelectorPlus.vue'
import LineSelectorPlus from '@/components/Selector/lineSelectorPlus.vue'
import EmployeeSelectorPlus from '@/components/Selector/employeeSelectorPlus.vue'
import PersonnelForm from '@/views/productionBusiness/employee/personnelReport/detail/personnelForm.vue'
import tool from '@/utils/tool'
import useFormHandler from '@/hook/useFormHandler'
import { required } from '@/utils/formRules'
import { useRoute } from 'vue-router'
import { message } from 'ant-design-vue'
const route = useRoute()
const basicInfoFormItems = [
{
label: '单号:',
name: 'number',
type: 'a-input',
attrs: {
placeholder: '请输入单号',
allowClear: true
}
},
{
label: '开工日期:',
name: 'workDate',
type: 'a-date-picker',
attrs: {
placeholder: '请输入开工日期',
allowClear: true,
valueFormat: 'YYYY-MM-DD HH:mm:ss'
}
},
{
label: '产品(物料)',
name: 'materialName',
type: 'a-input',
isUseSlot: true,
slotName: 'materialNameSlot',
attrs: {
placeholder: '请输入物料'
}
},
{
label: '基本单位:',
name: 'baseUnitName',
type: 'a-input',
attrs: {
disabled: true,
placeholder: '请输入物料'
}
},
{
label: '生产线:',
name: 'productionLineName',
isUseSlot: true,
slotName: 'productionLineNameSlot',
attrs: {
placeholder: '请选择生产线',
allowClear: true
}
},
{
label: '备注:',
name: 'aesKey',
type: 'a-textarea',
span: 24,
attrs: {
placeholder: '请输入签名方式',
allowClear: true
}
}
]
const formRules = {
name: [required('请输入名称')],
type: [required('请输入类型')],
appid: [required('请输入AppID')],
secret: [required('请输入AppSecret')]
}
let activeKey = ref('1')
const { formData, formRefs, inform, extendFormData, onSubmit, handleBack, fetchData, getExtendField } =
useFormHandler([...basicInfoFormItems], {
submitForm: manualTaskApi.manualTaskSubmitForm,
getDetail: manualTaskApi.manualTaskDetail
})
const onSubmitForm = () => {
onSubmit({ isDeep: true, ...formData, detailList: dataSource.value })
}
onMounted(async () => {
fetchData(route.query.type).then(async (res) => {
if (res) {
console.log(res)
}
})
})
/**
* 物料选择器
* */
const materielSelectorPlusRef = ref(null)
//
const openMateriel = () => {
materielSelectorPlusRef.value.showOpen()
}
//
let unitList = ref([])
let materielMoney = 0
//
const materielBackOk = (event) => {
formData.materialName = event.materielSelectedRows[0].name //
formData.materialId = event.materielSelectedRows[0].id // id
formData.materialNumber = event.materielSelectedRows[0].number // id
//
formData.baseUnitName = event.materielSelectedRows[0].baseUnitName //
formData.baseUnitId = event.materielSelectedRows[0].baseUnitId // id
//
materielMoney = event.materielSelectedRows[0].producePrice
}
/**
* 生产线选择器
* */
const lineSelectorPlusRef = ref(null)
const openLine = () => {
lineSelectorPlusRef.value.showOpen()
}
const lineBackOk = (event) => {
formData.productionLineName = event.tissueSelectedRows[0].name
formData.productionLineNumber = event.tissueSelectedRows[0].number
formData.productionLineId = event.tissueSelectedRows[0].id
}
/**
* 用户选择器
* */
const userSelectorPlusProRef = ref(null)
const handleOpenUser = () => {
if (materielMoney === 0) return message.error('请选择物料当前生产价格为0')
userSelectorPlusProRef.value.showUserPlusModal()
}
// API
const selectorApiFunction = {
orgTreeApi: (param) => {
return employeeCategoryApi.employeeCategoryTree(param).then((data) => {
return Promise.resolve(data)
})
},
userPageApi: (param) => {
return employeeApi.employeePage(param).then((data) => {
return Promise.resolve(data)
})
},
userListByIdListApi: (param) => {
return employeeApi.employeePage(param).then((data) => {
return Promise.resolve(data)
})
}
}
//
const userSelectorOnBack = (data) => {
if (data.length > 0) {
data.forEach((i) => {
dataSource.value.push({
employeeId: i.id,
employeeName: i.name,
employeeIdNumber: i.idNumber,
employeeNumber: i.number,
isFit: i.isFit,
payMode: null,
amount: null,
money: null
})
})
}
}
/**
* 人员列表
* */
const columns = [
{
title: '员工姓名',
dataIndex: 'employeeName',
editable: true,
align: 'center',
width: 200
},
{
title: '员工身份证号',
dataIndex: 'employeeIdNumber',
editable: true,
align: 'center',
width: 200
},
{
title: '员工编号',
dataIndex: 'employeeNumber',
editable: true,
align: 'center',
width: 200
},
{
title: '是否合适',
dataIndex: 'isFit',
editable: true,
align: 'center',
width: 200
},
{
title: '支付方式',
dataIndex: 'payMode',
editable: true,
align: 'center',
width: 200
},
{
title: '生产数量',
dataIndex: 'amount',
editable: true,
align: 'center',
width: 200
},
{
title: '金额',
dataIndex: 'money',
editable: true,
align: 'center',
width: 200
}
]
const dataSource = ref([])
//
const amountChange = (event, record) => {
record.money = event * materielMoney
}
/**
* 添加人员
* */
const personnelFormRef = ref(null)
const handleOpenAddUser = () => {
personnelFormRef.value.onOpen()
}
const successful = (data) => {
dataSource.value.push({
employeeId: data.id,
employeeName: data.name,
employeeIdNumber: data.idNumber,
employeeNumber: data.number,
isFit: data.isFit,
payMode: null,
amount: null,
money: null
})
}
</script>
<style scoped></style>

View File

@ -0,0 +1,130 @@
<template>
<xn-form-container title="新增员工" :width="700" :visible="visible" :destroy-on-close="true" @close="onClose">
<a-form ref="formRef" :model="formData" :rules="formRules" layout="vertical">
<a-row :gutter="16">
<a-col :span="24">
<a-form-item label="姓名:" name="name">
<a-input
:disabled="pageType === 'SEARCH'"
v-model:value="formData.name"
placeholder="请输入姓名"
allow-clear
/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="性别:" name="sex">
<a-select
:disabled="pageType === 'SEARCH'"
v-model:value="formData.sex"
placeholder="请选择性别"
:options="tool.dictList('GENDER')"
allow-clear
/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="手机号码:" name="phone">
<a-input
:disabled="pageType === 'SEARCH'"
v-model:value="formData.phone"
placeholder="请输入手机号码"
allow-clear
/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="是否合适:" name="isFit">
<a-select
:disabled="pageType === 'SEARCH'"
v-model:value="formData.isFit"
placeholder="请选择是否合适"
:options="tool.dictList('FIT_STATE')"
allow-clear
/>
</a-form-item>
</a-col>
<a-col :span="24">
<a-form-item label="员工分类:" name="categoryId">
<a-tree-select
:disabled="pageType === 'SEARCH'"
v-model:value="formData.categoryId"
style="width: 100%"
:dropdown-style="{ maxHeight: '400px', overflow: 'auto' }"
:tree-data="treeData"
placeholder="请选择上级员工分类"
:fieldNames="{
children: 'children',
label: 'name',
value: 'id'
}"
>
</a-tree-select>
</a-form-item>
</a-col>
</a-row>
</a-form>
<template #footer>
<a-button style="margin-right: 8px" @click="onClose"></a-button>
<a-button v-if="pageType !== 'SEARCH'" type="primary" @click="onSubmit" :loading="submitLoading"></a-button>
</template>
</xn-form-container>
</template>
<script setup>
import { cloneDeep } from 'lodash-es'
import { required } from '@/utils/formRules'
import employeeCategoryApi from '@/api/base/employee/employeeCategoryApi'
import employeeApi from '@/api/base/employee/employeeApi'
import tool from '@/utils/tool'
//
const visible = ref(false)
const emit = defineEmits({ successful: null })
const formRef = ref()
const formData = ref({})
const submitLoading = ref(false)
let pageType = ref('ADD')
//
const onOpen = (record) => {
visible.value = true
employeeCategoryApi.employeeCategoryTree().then((res) => {
treeData.value = res ? res : []
})
}
//
const onClose = () => {
formRef.value.resetFields()
visible.value = false
formRef.value = {}
}
// refresh
const formRules = {
name: [required('请输入姓名')]
}
//
const onSubmit = () => {
formRef.value.validate().then(() => {
submitLoading.value = true
const formDataParam = cloneDeep(formData.value)
employeeApi
.employeeAddShort(formDataParam, formDataParam.id)
.then((res) => {
onClose()
emit('successful', res)
})
.finally(() => {
submitLoading.value = false
})
})
}
let treeData = ref([])
//
defineExpose({
onOpen
})
</script>

View File

@ -0,0 +1,185 @@
<template>
<a-card :bordered="false">
<a-form ref="searchFormRef" name="advanced_search" :model="searchFormState" class="ant-advanced-search-form">
<a-row :gutter="24">
<a-col :span="6">
<a-form-item label="编码" name="number">
<a-input v-model:value="searchFormState.number" placeholder="请输入编码" />
</a-form-item>
</a-col>
<a-col :span="6">
<a-form-item label="名称" name="name">
<a-input v-model:value="searchFormState.name" placeholder="请输入名称" />
</a-form-item>
</a-col>
<a-col :span="6">
<a-form-item label="可用状态" name="enabledState">
<a-select
v-model:value="searchFormState.enabledState"
placeholder="请选择可用状态"
:options="$TOOL.dictList('COMMON_STATUS')"
/>
</a-form-item>
</a-col>
<a-col :span="6">
<a-button type="primary" @click="tableRef.refresh()"></a-button>
<a-button style="margin: 0 8px" @click="reset"></a-button>
</a-col>
</a-row>
</a-form>
</a-card>
<a-card :bordered="false" class="mt-4" style="height: 100%">
<s-table
ref="tableRef"
:columns="columns"
:data="loadData"
:alert="options.alert.show"
bordered
:row-key="(record) => record.id"
:tool-config="options.toolConfig"
:row-selection="options.rowSelection"
:scroll="{
x: 100
}"
>
<template #operator>
<a-space>
<a-button
type="primary"
@click="
navigateTo('/employee/personnelReport/detail', {
type: 'ADD'
})
"
v-if="hasPerm('sysBrandAdd')"
>
<template #icon><plus-outlined /></template>
新增
</a-button>
<xn-batch-delete
v-if="hasPerm('sysBrandDelete')"
:selectedRowKeys="selectedRowKeys"
@batchDelete="deleteBatchRecords"
/>
</a-space>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'number'">
<a href="#">{{ record.number }}</a>
</template>
<template v-if="column.dataIndex === 'enabledState'">
<a-tag color="#87d068" v-if="record.enabledState === 'ENABLE'"></a-tag>
<a-tag color="#f50" v-if="record.enabledState === 'DISABLED'"></a-tag>
</template>
<template v-if="column.dataIndex === 'action'">
<a-space>
<a-tooltip title="查看">
<a
@click="
navigateTo('/employee/personnelReport/detail', {
type: 'SEARCH',
id: record.id
})
"
v-if="hasPerm('customerEdit')"
>
<EyeOutlined />
<!-- 查看-->
</a>
</a-tooltip>
<a-divider type="vertical" v-if="hasPerm(['customerEdit', 'customerDelete'], 'and')" />
<a-tooltip title="查看">
<a
@click="
navigateTo('/employee/personnelReport/detail', {
type: 'EDIT',
id: record.id
})
"
v-if="hasPerm('customerEdit')"
>
<FormOutlined />
<!-- 编辑-->
</a>
</a-tooltip>
<a-divider type="vertical" v-if="hasPerm(['customerEdit', 'customerDelete'], 'and')" />
<a-popconfirm title="确定要删除吗?" @confirm="deleteRecord(record)">
<a-button type="link" danger size="small" v-if="hasPerm('customerDelete')">
<DeleteOutlined />
<!-- 删除-->
</a-button>
</a-popconfirm>
</a-space>
</template>
</template>
</s-table>
</a-card>
</template>
<script setup name="brand">
import manualTaskApi from '@/api/base/manual-task/manualTaskApi'
import { useTableManagement } from '@/hook/useTableManagement'
const brandColumns = [
{
title: '编码',
dataIndex: 'number',
sorter: true,
sortDirections: ['descend', 'ascend'],
align: 'center',
resizable: true,
width: 300,
ellipsis: true
},
{
title: '名称',
dataIndex: 'name',
align: 'center',
resizable: true,
width: 300,
ellipsis: true
},
{
title: '可用状态',
dataIndex: 'enabledState',
align: 'center',
resizable: true,
width: 100,
ellipsis: true
},
{
title: '创建时间',
dataIndex: 'createTime',
sorter: true,
sortDirections: ['descend', 'ascend'],
align: 'center',
resizable: true,
width: 300,
ellipsis: true
}
]
const {
searchFormState,
tableRef,
selectedRowKeys,
columns,
loadData,
reset,
deleteRecord,
deleteBatchRecords,
options,
searchFormRef,
navigateTo
} = useTableManagement(
{
page: manualTaskApi.manualTaskPage,
delete: manualTaskApi.manualTaskDelete
},
brandColumns,
['sysBrandEdit', 'sysBrandDelete']
)
</script>

View File

@ -0,0 +1,147 @@
<template>
<a-page-header style="padding: 10px; font-size: 20px" @back="handleBack">
<template #extra>
<a-button v-if="route.query.type !== 'SEARCH'" key="1" type="primary" @click="onSubmit"></a-button>
</template>
</a-page-header>
<a-card :bordered="false" title="基本信息">
<DynamicForm
:allDisabled="route.query.type === 'SEARCH'"
:formItems="basicInfoFormItems"
:model="formData"
:rules="formRules"
ref="formRef1"
>
<template #productNameSlot="{ model, item }">
<a-input readonly v-bind="{ ...item.attrs }" v-model:value="model[item.name]" @click="openMateriel"></a-input>
</template>
<template #produceUnitNameSlot="{ model, item }">
<a-select v-bind="{ ...item.attrs }" v-model:value="model[item.name]" :options="unitList"></a-select>
</template>
<template #baseUnitNameSlot="{ model, item }">
<a-select v-bind="{ ...item.attrs }" v-model:value="model[item.name]" :options="unitList"></a-select>
</template>
<template #productionLineNameSlot="{ model, item }">
<a-input readonly v-bind="{ ...item.attrs }" v-model:value="model[item.name]" @click="openLine"></a-input>
</template>
</DynamicForm>
</a-card>
<a-card
:bordered="false"
class="mt-4"
style="height: 100%"
v-if="extendData.length > 0 || route.query.type !== 'ADD'"
>
<a-tabs v-model:activeKey="activeKey">
<a-tab-pane key="1" tab="扩展字段" forceRender v-if="extendData.length > 0">
<DynamicForm
:allDisabled="route.query.type === 'SEARCH'"
:formItems="extendData"
:model="extendFormData"
:rules="formRules"
v-if="extendData.length > 0"
/>
<a-empty v-else />
</a-tab-pane>
<a-tab-pane key="2" tab="操作信息" v-if="route.query.type !== 'ADD'">
<OperationalInformation :detailData="inform" :colSpan="6"></OperationalInformation>
</a-tab-pane>
</a-tabs>
</a-card>
<materiel-selector-plus ref="materielSelectorPlusRef" @ok="materielBackOk"></materiel-selector-plus>
<line-selector-plus ref="lineSelectorPlusRef" @ok="lineBackOk"></line-selector-plus>
</template>
<script setup name="taskDetail">
import { required } from '@/utils/formRules'
import produceTaskApi from '@/api/production/produceTask/produceTaskApi'
import useFormHandler from '@/hook/useFormHandler'
import { basicInfoFormItems } from '@/views/productionBusiness/productionCenter/task/formItems'
import { useRoute } from 'vue-router'
import MaterielSelectorPlus from '@/components/Selector/materielSelectorPlus.vue'
import unitApi from '@/api/base/unit/unitApi'
import LineSelectorPlus from '@/components/Selector/lineSelectorPlus.vue'
const route = useRoute()
const formRules = {
name: [required('请输入名称')],
type: [required('请输入类型')],
appid: [required('请输入AppID')],
secret: [required('请输入AppSecret')]
}
const formRef1 = ref(null)
let detailData = ref({})
let activeKey = ref('1')
let extendData = ref([])
const { formData, formRefs, inform, extendFormData, onSubmit, handleBack, fetchData, getExtendField } =
useFormHandler([...basicInfoFormItems], {
submitForm: produceTaskApi.produceTaskSubmitForm,
getDetail: produceTaskApi.produceTaskDetail
})
onMounted(async () => {
formRefs.value = [formRef1.value]
fetchData(route.query.type).then((res) => {
if (res) {
detailData.value = res
}
})
extendData.value = await getExtendField('MATERIAL')
})
/**
* 物料选择器
* */
const materielSelectorPlusRef = ref(null)
//
const openMateriel = () => {
materielSelectorPlusRef.value.showOpen()
}
//
let unitList = ref([])
//
const materielBackOk = (event) => {
formData.productName = event.materielSelectedRows[0].name //
formData.productId = event.materielSelectedRows[0].id // id
//
formData.produceUnitName = event.materielSelectedRows[0].produceUnitName //
formData.produceUnitId = event.materielSelectedRows[0].produceUnitId // id
formData.baseUnitName = event.materielSelectedRows[0].baseUnitName //
formData.baseUnitId = event.materielSelectedRows[0].baseUnitId // id
// id
unitApi
.sysUnitList({
groupId: event.materielSelectedRows[0].unitGroupId
})
.then((res) => {
unitList.value = res || []
})
}
/**
* 生产线选择器
* */
const lineSelectorPlusRef = ref(null)
const openLine = () => {
lineSelectorPlusRef.value.showOpen()
}
const lineBackOk = (event) => {
formData.productionLineName = event.tissueSelectedRows[0].name
formData.productionLineNumber = event.tissueSelectedRows[0].number
formData.productionLineId = event.tissueSelectedRows[0].id
}
</script>

View File

@ -0,0 +1,112 @@
import tool from '@/utils/tool'
import { required } from '@/utils/formRules'
export const basicInfoFormItems = [
{
label: '单号:',
name: 'number',
type: 'a-input',
attrs: {
placeholder: '请输入单号',
allowClear: true
}
},
{
label: '计划开工日期:',
name: 'producePlanDate',
type: 'a-date-picker',
attrs: {
placeholder: '请输入计划开工日期',
allowClear: true,
valueFormat: 'YYYY-MM-DD HH:mm:ss'
}
},
{
label: '生产类型:',
name: 'produceType',
type: 'a-select',
attrs: {
placeholder: '请输入生产类型',
allowClear: true,
options: tool.dictList('PRODUCE_TYPE')
}
},
{
label: '产品(物料)',
name: 'productName',
type: 'a-input',
isUseSlot: true,
slotName: 'productNameSlot',
attrs: {
placeholder: '请输入物料'
}
},
{
label: '批次:',
name: 'aesKey',
type: 'a-input',
attrs: {
placeholder: '请输入签名方式',
allowClear: true
}
},
{
label: '计划生产数量:',
name: 'producePlanAmount',
type: 'a-input-number',
attrs: {
placeholder: '请输入签名方式',
allowClear: true
}
},
{
label: '生产单位:', // 采购单位
name: 'produceUnitName',
isUseSlot: true,
slotName: 'produceUnitNameSlot',
attrs: {
placeholder: '请选择生产单位',
allowClear: true,
fieldNames: {
children: 'children',
label: 'name',
value: 'id'
}
}
},
{
label: '基本单位:',
name: 'baseUnitName',
isUseSlot: true,
slotName: 'baseUnitNameSlot',
attrs: {
placeholder: '请选择基本单位',
allowClear: true,
fieldNames: {
children: 'children',
label: 'name',
value: 'id'
}
}
},
{
label: '生产线:',
name: 'productionLineName',
isUseSlot: true,
slotName: 'productionLineNameSlot',
attrs: {
placeholder: '请选择生产线',
allowClear: true
}
},
{
label: '备注:',
name: 'aesKey',
type: 'a-textarea',
span: 24,
attrs: {
placeholder: '请输入签名方式',
allowClear: true
}
}
]

View File

@ -0,0 +1,241 @@
<template>
<a-card :bordered="false">
<a-form ref="searchFormRef" name="advanced_search" :model="searchFormState" class="ant-advanced-search-form">
<a-row :gutter="24">
<a-col :span="6">
<a-form-item label="名称" name="name">
<a-input v-model:value="searchFormState.name" placeholder="请输入名称" />
</a-form-item>
</a-col>
<a-col :span="6">
<a-form-item label="可用状态" name="enabledState">
<a-select
v-model:value="searchFormState.enabledState"
placeholder="请选择可用状态"
:options="$TOOL.dictList('COMMON_STATUS')"
/>
</a-form-item>
</a-col>
<a-col :span="6">
<a-button type="primary" @click="tableRef.refresh()"></a-button>
<a-button style="margin: 0 8px" @click="reset"></a-button>
</a-col>
</a-row>
</a-form>
</a-card>
<a-card :bordered="false" class="mt-4" style="height: 100%">
<s-table
ref="tableRef"
:columns="columns"
:data="loadData"
:alert="options.alert.show"
bordered
:row-key="(record) => record.id"
:tool-config="options.toolConfig"
:row-selection="options.rowSelection"
:scroll="{
x: 100
}"
>
<template #operator>
<a-space>
<a-button
type="primary"
@click="
navigateTo('/task/detail', {
type: 'ADD'
})
"
v-if="hasPerm('officialAccountAdd')"
>
<template #icon><plus-outlined /></template>
新增
</a-button>
<xn-batch-delete
v-if="hasPerm('officialAccountBatchDelete')"
:selectedRowKeys="selectedRowKeys"
@batchDelete="deleteBatchRecords"
/>
</a-space>
</template>
<template #bodyCell="{ column, record }">
<template v-if="column.dataIndex === 'number'">
<a href="#">{{ record.number }}</a>
</template>
<template v-if="column.dataIndex === 'enabledState'">
<a-tag color="#87d068" v-if="record.enabledState === 'ENABLE'"></a-tag>
<a-tag color="#f50" v-if="record.enabledState === 'DISABLED'"></a-tag>
</template>
<template v-if="column.dataIndex === 'action'">
<a-space>
<a-tooltip title="查看">
<a
@click="
navigateTo('/basicData/publicAccount/detail', {
type: 'SEARCH',
id: record.id
})
"
v-if="hasPerm('customerEdit')"
>
<EyeOutlined />
<!-- 查看-->
</a>
</a-tooltip>
<a-divider type="vertical" v-if="hasPerm(['customerEdit', 'customerDelete'], 'and')" />
<a-tooltip title="查看">
<a
@click="
navigateTo('/basicData/publicAccount/detail', {
type: 'EDIT',
id: record.id
})
"
v-if="hasPerm('customerEdit')"
>
<FormOutlined />
<!-- 编辑-->
</a>
</a-tooltip>
<a-divider type="vertical" v-if="hasPerm(['customerEdit', 'customerDelete'], 'and')" />
<a-popconfirm title="确定要删除吗?" @confirm="deleteRecord(record)">
<a-button type="link" danger size="small" v-if="hasPerm('customerDelete')">
<DeleteOutlined />
<!-- 删除-->
</a-button>
</a-popconfirm>
</a-space>
</template>
</template>
</s-table>
</a-card>
</template>
<script setup name="task">
import produceTaskApi from '@/api/production/produceTask/produceTaskApi'
import { useTableManagement } from '@/hook/useTableManagement'
const publicAccountColumn = [
{
title: '单号',
dataIndex: 'type',
align: 'center',
resizable: true,
width: 300,
ellipsis: true,
sorter: true,
sortDirections: ['descend', 'ascend']
},
{
title: '计划开工日期',
dataIndex: 'name',
align: 'center',
resizable: true,
width: 300,
ellipsis: true
},
{
title: '可用状态',
dataIndex: 'enabledState',
align: 'center',
resizable: true,
width: 100,
ellipsis: true
},
{
title: '生产类型',
dataIndex: 'createTime',
sorter: true,
sortDirections: ['descend', 'ascend'],
align: 'center',
resizable: true,
width: 300,
ellipsis: true
},
{
title: '产品名称',
dataIndex: 'createTime',
sorter: true,
sortDirections: ['descend', 'ascend'],
align: 'center',
resizable: true,
width: 300,
ellipsis: true
},
{
title: '产品编码',
dataIndex: 'createTime',
sorter: true,
sortDirections: ['descend', 'ascend'],
align: 'center',
resizable: true,
width: 300,
ellipsis: true
},
{
title: '生产线',
dataIndex: 'createTime',
sorter: true,
sortDirections: ['descend', 'ascend'],
align: 'center',
resizable: true,
width: 300,
ellipsis: true
},
{
title: '生产编码',
dataIndex: 'createTime',
sorter: true,
sortDirections: ['descend', 'ascend'],
align: 'center',
resizable: true,
width: 300,
ellipsis: true
},
{
title: '计划生产数量',
dataIndex: 'createTime',
sorter: true,
sortDirections: ['descend', 'ascend'],
align: 'center',
resizable: true,
width: 300,
ellipsis: true
},
{
title: '单位',
dataIndex: 'createTime',
sorter: true,
sortDirections: ['descend', 'ascend'],
align: 'center',
resizable: true,
width: 300,
ellipsis: true
}
]
const {
searchFormState,
tableRef,
selectedRowKeys,
columns,
loadData,
reset,
deleteRecord,
deleteBatchRecords,
options,
searchFormRef,
toolConfig,
navigateTo
} = useTableManagement(
{
page: produceTaskApi.produceTaskPage,
delete: produceTaskApi.produceTaskDelete
},
publicAccountColumn,
['officialAccountEdit', 'officialAccountDelete']
)
</script>