基础资料优化处理
parent
d60c2992f7
commit
f31d914790
|
@ -24,5 +24,9 @@ export default {
|
||||||
// 获取员工详情
|
// 获取员工详情
|
||||||
employeeDetail(data) {
|
employeeDetail(data) {
|
||||||
return request('detail', data, 'get')
|
return request('detail', data, 'get')
|
||||||
|
},
|
||||||
|
// 添加员工基本信息
|
||||||
|
employeeAddShort(data) {
|
||||||
|
return request('addShort', data, 'post')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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')
|
||||||
|
}
|
||||||
|
}
|
|
@ -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')
|
||||||
|
}
|
||||||
|
}
|
|
@ -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')
|
||||||
|
}
|
||||||
|
}
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -121,8 +121,8 @@
|
||||||
typeof props.alert === 'boolean' && props.alert
|
typeof props.alert === 'boolean' && props.alert
|
||||||
? clearSelected()
|
? clearSelected()
|
||||||
: props.alert.clear && typeof props.alert.clear === 'function'
|
: props.alert.clear && typeof props.alert.clear === 'function'
|
||||||
? props.alert.clear()
|
? props.alert.clear()
|
||||||
: null
|
: null
|
||||||
)
|
)
|
||||||
"
|
"
|
||||||
>
|
>
|
||||||
|
@ -167,7 +167,7 @@
|
||||||
import { get } from 'lodash-es'
|
import { get } from 'lodash-es'
|
||||||
const slots = useSlots()
|
const slots = useSlots()
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const emit = defineEmits(['expand', 'plusRowData', 'editRowData', 'deleteRowData'])
|
const emit = defineEmits(['expand', 'plusRowData', 'editRowData', 'deleteRowData', 'refresh'])
|
||||||
const renderSlots = Object.keys(slots)
|
const renderSlots = Object.keys(slots)
|
||||||
|
|
||||||
const props = defineProps(
|
const props = defineProps(
|
||||||
|
@ -347,6 +347,7 @@
|
||||||
))
|
))
|
||||||
loadData()
|
loadData()
|
||||||
getTableProps()
|
getTableProps()
|
||||||
|
emit('refresh')
|
||||||
}
|
}
|
||||||
// 斑马纹勾选
|
// 斑马纹勾选
|
||||||
const changeRowClass = (v) => {
|
const changeRowClass = (v) => {
|
||||||
|
|
|
@ -7,9 +7,10 @@ import extendFieldApi from '@/api/base/extendfield/extendFieldApi'
|
||||||
* 使用表单处理程序封装表单的提交、初始化和回退逻辑。
|
* 使用表单处理程序封装表单的提交、初始化和回退逻辑。
|
||||||
* @param {Array} formItems 表单项配置,包含表单字段名、默认值等信息。
|
* @param {Array} formItems 表单项配置,包含表单字段名、默认值等信息。
|
||||||
* @param {Object} api 包含表单提交和获取详情方法的对象。
|
* @param {Object} api 包含表单提交和获取详情方法的对象。
|
||||||
|
* @param backRouter
|
||||||
* @returns {Object} 返回包含表单数据、提交加载状态、表单引用、提交函数等的对象。
|
* @returns {Object} 返回包含表单数据、提交加载状态、表单引用、提交函数等的对象。
|
||||||
*/
|
*/
|
||||||
export default function useFormHandler(formItems, api) {
|
export default function useFormHandler(formItems, api, backRouter) {
|
||||||
// 初始化页面类型状态
|
// 初始化页面类型状态
|
||||||
const state = reactive({
|
const state = reactive({
|
||||||
PAGE_TYPE: ''
|
PAGE_TYPE: ''
|
||||||
|
@ -68,7 +69,7 @@ export default function useFormHandler(formItems, api) {
|
||||||
// 调用api提交表单数据
|
// 调用api提交表单数据
|
||||||
await api.submitForm(formDataParam, safeId)
|
await api.submitForm(formDataParam, safeId)
|
||||||
// 提交成功后返回上一页,并关闭当前标签页
|
// 提交成功后返回上一页,并关闭当前标签页
|
||||||
handleBack()
|
handleBack(backRouter)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Validation error:', error)
|
console.error('Validation error:', error)
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -92,9 +93,9 @@ export default function useFormHandler(formItems, api) {
|
||||||
/**
|
/**
|
||||||
* 处理返回操作,返回上一级页面并关闭当前标签页。
|
* 处理返回操作,返回上一级页面并关闭当前标签页。
|
||||||
*/
|
*/
|
||||||
const handleBack = () => {
|
const handleBack = (routerPath) => {
|
||||||
// useTabs.close(route)
|
// useTabs.close(route)
|
||||||
router.push('/basicData/publicAccount') // 优化为通用的返回上一页操作
|
useTabs.close('', routerPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -148,24 +149,26 @@ export default function useFormHandler(formItems, api) {
|
||||||
|
|
||||||
if (resExtendField) {
|
if (resExtendField) {
|
||||||
resExtendField.forEach((item) => {
|
resExtendField.forEach((item) => {
|
||||||
const showValues = JSON.parse(item.showValues)
|
if (item.showValues) {
|
||||||
let options = []
|
const showValues = JSON.parse(item.showValues)
|
||||||
showValues.forEach((value) => {
|
let options = []
|
||||||
options.push({
|
showValues.forEach((value) => {
|
||||||
value: value.name,
|
options.push({
|
||||||
label: value.name
|
value: value.name,
|
||||||
|
label: value.name
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
extendData.push({
|
||||||
extendData.push({
|
label: item.name,
|
||||||
label: item.name,
|
name: item.fieldName,
|
||||||
name: item.fieldName,
|
type: item.showType,
|
||||||
type: item.showType,
|
span: 6,
|
||||||
span: 6,
|
attrs: {
|
||||||
attrs: {
|
placeholder: '请输入内容',
|
||||||
placeholder: '请输入内容',
|
options
|
||||||
options
|
}
|
||||||
}
|
})
|
||||||
})
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
extendData.forEach((item) => {
|
extendData.forEach((item) => {
|
||||||
|
|
|
@ -7,10 +7,11 @@ import useTabs from '@/utils/useTabs'
|
||||||
* 列表页面表格信息 hook 封装(数据操作)
|
* 列表页面表格信息 hook 封装(数据操作)
|
||||||
* @param apiModule 调用接口
|
* @param apiModule 调用接口
|
||||||
* @param tableColumns 表格头部信息
|
* @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}}
|
* @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 searchFormState = ref({})
|
||||||
const searchFormRef = ref(null)
|
const searchFormRef = ref(null)
|
||||||
const selectedRowKeys = ref([])
|
const selectedRowKeys = ref([])
|
||||||
|
@ -43,7 +44,7 @@ export function useTableManagement(apiModule = {}, tableColumns, hasPermData) {
|
||||||
if (hasPerm(hasPermData)) {
|
if (hasPerm(hasPermData)) {
|
||||||
// 判断columns 是否有操作
|
// 判断columns 是否有操作
|
||||||
const columnsFilter = columns.value.filter((item) => item.dataIndex === 'action')
|
const columnsFilter = columns.value.filter((item) => item.dataIndex === 'action')
|
||||||
if (columnsFilter.length === 0)
|
if (columnsFilter.length === 0 && isShowAction)
|
||||||
columns.value.unshift({
|
columns.value.unshift({
|
||||||
title: '操作',
|
title: '操作',
|
||||||
dataIndex: 'action',
|
dataIndex: 'action',
|
||||||
|
|
|
@ -319,7 +319,9 @@
|
||||||
background: none;
|
background: none;
|
||||||
height: 40px;
|
height: 40px;
|
||||||
line-height: 40px;
|
line-height: 40px;
|
||||||
transition: background-color 0.3s, color 0.3s;
|
transition:
|
||||||
|
background-color 0.3s,
|
||||||
|
color 0.3s;
|
||||||
padding: 0 16px;
|
padding: 0 16px;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
border: none;
|
border: none;
|
||||||
|
@ -440,7 +442,9 @@
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
border-radius: 10px 10px 0 0 !important;
|
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 {
|
.snowy-radius .ant-tabs-tab-active::before {
|
||||||
content: '';
|
content: '';
|
||||||
|
|
|
@ -18,7 +18,7 @@ export const viewTagsStore = defineStore('viewTags', () => {
|
||||||
const pushViewTags = (route) => {
|
const pushViewTags = (route) => {
|
||||||
const target = viewTags.value.find((item) => item.path === route.path)
|
const target = viewTags.value.find((item) => item.path === route.path)
|
||||||
const isName = route.name
|
const isName = route.name
|
||||||
if (!target) {
|
if (!target && isName) {
|
||||||
viewTags.value.push(route)
|
viewTags.value.push(route)
|
||||||
}
|
}
|
||||||
if (target) {
|
if (target) {
|
||||||
|
|
|
@ -36,7 +36,6 @@ export default {
|
||||||
keepAliveStore().removeKeepLive(route.name)
|
keepAliveStore().removeKeepLive(route.name)
|
||||||
const tagList = store.viewTags
|
const tagList = store.viewTags
|
||||||
const latestView = tagList.slice(-1)[0]
|
const latestView = tagList.slice(-1)[0]
|
||||||
console.log(latestView, 'route')
|
|
||||||
if (latestView) {
|
if (latestView) {
|
||||||
router.push(latestView)
|
router.push(latestView)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -40,8 +40,7 @@
|
||||||
:tool-config="options.toolConfig"
|
:tool-config="options.toolConfig"
|
||||||
:row-selection="options.rowSelection"
|
:row-selection="options.rowSelection"
|
||||||
:scroll="{
|
:scroll="{
|
||||||
x: 100,
|
x: 100
|
||||||
|
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<template #operator>
|
<template #operator>
|
||||||
|
|
|
@ -142,12 +142,14 @@
|
||||||
let cityOptionsCounty = ref([])
|
let cityOptionsCounty = ref([])
|
||||||
|
|
||||||
const onChangeProvince = (value, options) => {
|
const onChangeProvince = (value, options) => {
|
||||||
console.log(options)
|
|
||||||
cityOptionsCity.value = options.children
|
cityOptionsCity.value = options.children
|
||||||
|
formData.city = null
|
||||||
|
formData.county = null
|
||||||
}
|
}
|
||||||
|
|
||||||
const onChangeCity = (value, options) => {
|
const onChangeCity = (value, options) => {
|
||||||
cityOptionsCounty.value = options.children
|
cityOptionsCounty.value = options.children
|
||||||
|
formData.county = null
|
||||||
}
|
}
|
||||||
|
|
||||||
const filterOption = (input, option) => {
|
const filterOption = (input, option) => {
|
||||||
|
@ -253,7 +255,7 @@
|
||||||
isUseSlot: true,
|
isUseSlot: true,
|
||||||
slotName: 'countySlot',
|
slotName: 'countySlot',
|
||||||
span: 8,
|
span: 8,
|
||||||
rules: [required('请选择区')],
|
rules: [required('请选择区')]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'address',
|
name: 'address',
|
||||||
|
@ -390,7 +392,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
console.log(1)
|
|
||||||
formRefs.value = [formRef1.value, formRef2.value]
|
formRefs.value = [formRef1.value, formRef2.value]
|
||||||
fetchData(route.query.type).then((res) => {
|
fetchData(route.query.type).then((res) => {
|
||||||
if (res) {
|
if (res) {
|
||||||
|
@ -431,6 +432,8 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// 展示 省级 数据
|
||||||
})
|
})
|
||||||
|
|
||||||
let activeKey = ref('1')
|
let activeKey = ref('1')
|
||||||
|
|
|
@ -33,13 +33,13 @@ export const materielColumn = [
|
||||||
width: 150,
|
width: 150,
|
||||||
ellipsis: true
|
ellipsis: true
|
||||||
},
|
},
|
||||||
// {
|
{
|
||||||
// title: '分类',
|
title: '分类',
|
||||||
// dataIndex: 'name',
|
dataIndex: 'categoryName',
|
||||||
// align: 'center',
|
align: 'center',
|
||||||
// resizable: true,
|
resizable: true,
|
||||||
// width: 150
|
width: 150
|
||||||
// },
|
},
|
||||||
{
|
{
|
||||||
title: '品牌',
|
title: '品牌',
|
||||||
dataIndex: 'brandName',
|
dataIndex: 'brandName',
|
||||||
|
|
|
@ -26,7 +26,16 @@
|
||||||
ref="formRef2"
|
ref="formRef2"
|
||||||
/>
|
/>
|
||||||
</a-tab-pane>
|
</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
|
<DynamicForm
|
||||||
:allDisabled="route.query.type === 'SEARCH'"
|
:allDisabled="route.query.type === 'SEARCH'"
|
||||||
:formItems="unitFormItems"
|
:formItems="unitFormItems"
|
||||||
|
@ -35,9 +44,9 @@
|
||||||
ref="formRef3"
|
ref="formRef3"
|
||||||
/>
|
/>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
<a-tab-pane key="3" tab="包装关系" forceRender>
|
<a-tab-pane key="4" tab="包装关系" forceRender>
|
||||||
<a-table :dataSource="dataSource" :columns="columns">
|
<a-table :dataSource="dataSource" :columns="columns" :pagination="false">
|
||||||
<template #bodyCell="{ column, record }">
|
<template #bodyCell="{ column, record, index }">
|
||||||
<template v-if="column.dataIndex === 'enabledState'">
|
<template v-if="column.dataIndex === 'enabledState'">
|
||||||
<a-switch
|
<a-switch
|
||||||
:disabled="route.query.type === 'SEARCH'"
|
:disabled="route.query.type === 'SEARCH'"
|
||||||
|
@ -50,7 +59,7 @@
|
||||||
</template>
|
</template>
|
||||||
<template v-if="column.dataIndex === 'unitId'">
|
<template v-if="column.dataIndex === 'unitId'">
|
||||||
<a-select
|
<a-select
|
||||||
:disabled="route.query.type === 'SEARCH'"
|
:disabled="route.query.type === 'SEARCH' || index === 0"
|
||||||
style="width: 100%"
|
style="width: 100%"
|
||||||
placeholder="请选择单位"
|
placeholder="请选择单位"
|
||||||
v-model:value="record.unitId"
|
v-model:value="record.unitId"
|
||||||
|
@ -60,7 +69,11 @@
|
||||||
value: 'id'
|
value: 'id'
|
||||||
}"
|
}"
|
||||||
allowClear
|
allowClear
|
||||||
@change="onChangeUnit"
|
@change="
|
||||||
|
(value, options) => {
|
||||||
|
onChangeUnit(value, options, record)
|
||||||
|
}
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
<template v-if="column.dataIndex === 'productQty'">
|
<template v-if="column.dataIndex === 'productQty'">
|
||||||
|
@ -73,10 +86,13 @@
|
||||||
<template v-if="column.dataIndex === 'name'">
|
<template v-if="column.dataIndex === 'name'">
|
||||||
<a-input :disabled="route.query.type === 'SEARCH'" v-model:value="record.name" />
|
<a-input :disabled="route.query.type === 'SEARCH'" v-model:value="record.name" />
|
||||||
</template>
|
</template>
|
||||||
|
<template v-if="column.dataIndex === 'rate'">
|
||||||
|
<a-input disabled v-model:value="record.rate" />
|
||||||
|
</template>
|
||||||
</template>
|
</template>
|
||||||
</a-table>
|
</a-table>
|
||||||
</a-tab-pane>
|
</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 :model="productFormData" class="w-1/3" layout="vertical">
|
||||||
<a-form-item label="是否启用" name="promoteEnabledState">
|
<a-form-item label="是否启用" name="promoteEnabledState">
|
||||||
<a-select
|
<a-select
|
||||||
|
@ -108,7 +124,7 @@
|
||||||
</a-form-item>
|
</a-form-item>
|
||||||
</a-form>
|
</a-form>
|
||||||
</a-tab-pane>
|
</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
|
<DynamicForm
|
||||||
:allDisabled="route.query.type === 'SEARCH'"
|
:allDisabled="route.query.type === 'SEARCH'"
|
||||||
:formItems="extendData"
|
:formItems="extendData"
|
||||||
|
@ -119,9 +135,12 @@
|
||||||
|
|
||||||
<a-empty v-else />
|
<a-empty v-else />
|
||||||
</a-tab-pane>
|
</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>
|
<OperationalInformation :detailData="inform" :colSpan="6"></OperationalInformation>
|
||||||
</a-tab-pane>
|
</a-tab-pane>
|
||||||
|
<template #rightExtra v-if="activeKey === '3'">
|
||||||
|
<a-button @click="handleCompute">包装比例转换</a-button>
|
||||||
|
</template>
|
||||||
</a-tabs>
|
</a-tabs>
|
||||||
</a-card>
|
</a-card>
|
||||||
</template>
|
</template>
|
||||||
|
@ -138,11 +157,14 @@
|
||||||
import materialCategoryApi from '@/api/base/material/materialCategoryApi'
|
import materialCategoryApi from '@/api/base/material/materialCategoryApi'
|
||||||
import { message } from 'ant-design-vue'
|
import { message } from 'ant-design-vue'
|
||||||
import sysBrandApi from '@/api/base/brand/sysBrandApi'
|
import sysBrandApi from '@/api/base/brand/sysBrandApi'
|
||||||
|
import { notification } from 'ant-design-vue'
|
||||||
|
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
|
|
||||||
const formRef1 = ref(null)
|
const formRef1 = ref(null)
|
||||||
const formRef2 = ref(null)
|
const formRef2 = ref(null)
|
||||||
const formRef3 = ref(null)
|
const formRef3 = ref(null)
|
||||||
|
const formRef4 = ref(null)
|
||||||
|
|
||||||
let dataSource = ref([])
|
let dataSource = ref([])
|
||||||
let unitOptions = reactive([])
|
let unitOptions = reactive([])
|
||||||
|
@ -152,7 +174,7 @@
|
||||||
let extendData = ref([]) // 扩展字段
|
let extendData = ref([]) // 扩展字段
|
||||||
|
|
||||||
onMounted(async () => {
|
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) => {
|
fetchData(route.query.type).then(async (res) => {
|
||||||
if (res) {
|
if (res) {
|
||||||
productFormData.value.promoteEnabledState = res.promoteEnabledState
|
productFormData.value.promoteEnabledState = res.promoteEnabledState
|
||||||
|
@ -182,7 +204,7 @@
|
||||||
const packageType = tool.dictList('MATERIAL_PACKAGE_TYPE')
|
const packageType = tool.dictList('MATERIAL_PACKAGE_TYPE')
|
||||||
packageType.forEach((item) => {
|
packageType.forEach((item) => {
|
||||||
dataSource.value.push({
|
dataSource.value.push({
|
||||||
enabledState: 'ENABLE',
|
enabledState: 'DISABLE',
|
||||||
number: item.value,
|
number: item.value,
|
||||||
type: item.label,
|
type: item.label,
|
||||||
name: item.label,
|
name: item.label,
|
||||||
|
@ -255,6 +277,11 @@
|
||||||
unitOptions = res
|
unitOptions = res
|
||||||
const resFilter = res.filter((item) => item.isBase === 'YES')
|
const resFilter = res.filter((item) => item.isBase === 'YES')
|
||||||
if (resFilter.length > 0) formData.baseUnitId = resFilter[0].id
|
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) {
|
function getBase64(img, callback) {
|
||||||
const reader = new FileReader()
|
const reader = new FileReader()
|
||||||
reader.addEventListener('load', () => callback(reader.result))
|
reader.addEventListener('load', () => callback(reader.result))
|
||||||
|
@ -341,7 +367,7 @@
|
||||||
type: 'a-input',
|
type: 'a-input',
|
||||||
span: 6,
|
span: 6,
|
||||||
attrs: {
|
attrs: {
|
||||||
placeholder: '请输入名称',
|
placeholder: '请输入简称',
|
||||||
allowClear: true
|
allowClear: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -351,7 +377,7 @@
|
||||||
type: 'a-input',
|
type: 'a-input',
|
||||||
span: 6,
|
span: 6,
|
||||||
attrs: {
|
attrs: {
|
||||||
placeholder: '请输入名称',
|
placeholder: '请输入别名',
|
||||||
allowClear: true
|
allowClear: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -361,7 +387,7 @@
|
||||||
type: 'a-input',
|
type: 'a-input',
|
||||||
span: 6,
|
span: 6,
|
||||||
attrs: {
|
attrs: {
|
||||||
placeholder: '请输入名称',
|
placeholder: '请输入规格型号',
|
||||||
allowClear: true
|
allowClear: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -370,9 +396,11 @@
|
||||||
name: 'packageProportion',
|
name: 'packageProportion',
|
||||||
type: 'a-input',
|
type: 'a-input',
|
||||||
span: 6,
|
span: 6,
|
||||||
|
rules: [required('请输入包装比例')],
|
||||||
attrs: {
|
attrs: {
|
||||||
placeholder: '请输入名称',
|
placeholder: '请输入包装比例',
|
||||||
allowClear: true
|
allowClear: true,
|
||||||
|
disabled: true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -381,7 +409,7 @@
|
||||||
type: 'a-input',
|
type: 'a-input',
|
||||||
span: 6,
|
span: 6,
|
||||||
attrs: {
|
attrs: {
|
||||||
placeholder: '请输入名称',
|
placeholder: '请输入助记码',
|
||||||
allowClear: true
|
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 = [
|
const columns = [
|
||||||
{
|
{
|
||||||
title: '启用',
|
title: '启用',
|
||||||
dataIndex: 'enabledState',
|
dataIndex: 'enabledState',
|
||||||
editable: true,
|
editable: true,
|
||||||
align: 'center'
|
align: 'center',
|
||||||
|
width: 100
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '条码类型编码',
|
title: '条码类型编码',
|
||||||
dataIndex: 'number',
|
dataIndex: 'number',
|
||||||
editable: true,
|
editable: true,
|
||||||
align: 'center'
|
align: 'center',
|
||||||
|
width: 200
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '条码类型',
|
title: '条码类型',
|
||||||
dataIndex: 'type',
|
dataIndex: 'type',
|
||||||
editable: true,
|
editable: true,
|
||||||
align: 'center'
|
align: 'center',
|
||||||
|
width: 200
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '包装关系名称',
|
title: '包装关系名称',
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
editable: true,
|
editable: true,
|
||||||
align: 'center'
|
align: 'center',
|
||||||
|
width: 200
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '单位',
|
title: '单位',
|
||||||
dataIndex: 'unitId',
|
dataIndex: 'unitId',
|
||||||
editable: true,
|
editable: true,
|
||||||
align: 'center'
|
align: 'center',
|
||||||
|
width: 200
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title: '换算率',
|
||||||
|
dataIndex: 'rate',
|
||||||
|
editable: true,
|
||||||
|
align: 'center',
|
||||||
|
width: 200
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: '产品数',
|
title: '产品数',
|
||||||
dataIndex: 'productQty',
|
dataIndex: 'productQty',
|
||||||
editable: true,
|
editable: true,
|
||||||
align: 'center'
|
align: 'center',
|
||||||
|
width: 200
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
const onChangeUnit = (value) => {
|
const [api, contextHolder] = notification.useNotification()
|
||||||
const unitIdList = new Set(dataSource.value.map((item) => item.unitId))
|
const onChangeUnit = (value, options, record) => {
|
||||||
|
record.rate = options.rate
|
||||||
|
}
|
||||||
|
|
||||||
// 更新 unitOptions 的 disabled 属性
|
const handleCompute = () => {
|
||||||
unitOptions.forEach((item) => {
|
const enabledStateFilter = dataSource.value.filter((item) => item.enabledState === 'ENABLE')
|
||||||
item.disabled = unitIdList.has(item.id)
|
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 } =
|
const { formData, formRefs, inform, extendFormData, onSubmit, handleBack, fetchData, getExtendField } =
|
||||||
|
|
|
@ -57,7 +57,7 @@
|
||||||
:tool-config="options.toolConfig"
|
:tool-config="options.toolConfig"
|
||||||
:row-selection="options.rowSelection"
|
:row-selection="options.rowSelection"
|
||||||
:scroll="{
|
:scroll="{
|
||||||
x: 100,
|
x: 100
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<template #operator class="table-operator">
|
<template #operator class="table-operator">
|
||||||
|
@ -139,6 +139,7 @@
|
||||||
</a-col>
|
</a-col>
|
||||||
</a-row>
|
</a-row>
|
||||||
</a-card>
|
</a-card>
|
||||||
|
|
||||||
<material-category-form ref="materialCategoryFormRef" @successful="successful"></material-category-form>
|
<material-category-form ref="materialCategoryFormRef" @successful="successful"></material-category-form>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -54,10 +54,7 @@
|
||||||
let recordData = cloneDeep(record)
|
let recordData = cloneDeep(record)
|
||||||
formData.value = Object.assign({}, recordData)
|
formData.value = Object.assign({}, recordData)
|
||||||
} else {
|
} else {
|
||||||
formData.value.number = ''
|
formData.value = { name: '', number: '', enabledState: 'ENABLE' }
|
||||||
formData.value.name = ''
|
|
||||||
formData.value.enabledState = 'ENABLE'
|
|
||||||
formData.id = ''
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 关闭抽屉
|
// 关闭抽屉
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<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>
|
<template #extra>
|
||||||
<a-button key="1" type="primary" @click="onSubmitForm">保存</a-button>
|
<a-button key="1" type="primary" @click="onSubmitForm">保存</a-button>
|
||||||
</template>
|
</template>
|
||||||
|
@ -51,6 +51,7 @@
|
||||||
const formRules = {
|
const formRules = {
|
||||||
unitGroupId: [required('请选择单位')],
|
unitGroupId: [required('请选择单位')],
|
||||||
name: [required('请输入名称')],
|
name: [required('请输入名称')],
|
||||||
|
rate: [required('请输入换算率')],
|
||||||
isBase: [required('请选择是否基本单位')]
|
isBase: [required('请选择是否基本单位')]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,7 +127,9 @@
|
||||||
span: 6,
|
span: 6,
|
||||||
attrs: {
|
attrs: {
|
||||||
placeholder: '请输入换算率',
|
placeholder: '请输入换算率',
|
||||||
allowClear: true
|
allowClear: true,
|
||||||
|
min: 1,
|
||||||
|
precision: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -164,8 +167,12 @@
|
||||||
])
|
])
|
||||||
|
|
||||||
const { formData, formRefs, inform, extendFormData, onSubmit, handleBack, fetchData, getExtendField } =
|
const { formData, formRefs, inform, extendFormData, onSubmit, handleBack, fetchData, getExtendField } =
|
||||||
useFormHandler([...unitFormItems], {
|
useFormHandler(
|
||||||
submitForm: unitApi.sysUnitSubmitForm,
|
[...unitFormItems],
|
||||||
getDetail: unitApi.sysUnitDetail
|
{
|
||||||
})
|
submitForm: unitApi.sysUnitSubmitForm,
|
||||||
|
getDetail: unitApi.sysUnitDetail
|
||||||
|
},
|
||||||
|
'/basicData/unit'
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
@plusRowData="handlePlusRowData"
|
@plusRowData="handlePlusRowData"
|
||||||
@editRowData="handleEditRowData"
|
@editRowData="handleEditRowData"
|
||||||
@deleteRowData="handleDeleteRowData"
|
@deleteRowData="handleDeleteRowData"
|
||||||
|
@refresh="handleRefresh"
|
||||||
:rowSelection="unitGroupRowSelection"
|
:rowSelection="unitGroupRowSelection"
|
||||||
>
|
>
|
||||||
<template #operator class="table-operator">
|
<template #operator class="table-operator">
|
||||||
|
@ -265,6 +266,10 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const handleRefresh = () => {
|
||||||
|
unitGroupTableRef.value.clearSelected()
|
||||||
|
}
|
||||||
|
|
||||||
const successful = () => {
|
const successful = () => {
|
||||||
searchFormState.value.unitGroupId = ''
|
searchFormState.value.unitGroupId = ''
|
||||||
tableRef.value.refresh()
|
tableRef.value.refresh()
|
||||||
|
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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>
|
|
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
|
@ -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>
|
Loading…
Reference in New Issue