基础模块接口调试完成
This commit is contained in:
parent
727deb8b4b
commit
478b20ef44
|
|
@ -3,25 +3,17 @@ import request from '@/utils/request'
|
|||
// 业务类型管理 - 查询列表
|
||||
export function listBusinessTypeAPI(query) {
|
||||
return request({
|
||||
url: '/basic/businessType/list',
|
||||
method: 'get',
|
||||
url: '/planMajor/getPlanMajorList',
|
||||
method: 'GET',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
// 业务类型管理 - 查询详情
|
||||
export function getBusinessTypeAPI(id) {
|
||||
return request({
|
||||
url: `/basic/businessType/${id}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 业务类型管理 - 新增
|
||||
export function addBusinessTypeAPI(data) {
|
||||
return request({
|
||||
url: '/basic/businessType',
|
||||
method: 'post',
|
||||
url: '/planMajor/addPlanMajor',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
@ -29,16 +21,17 @@ export function addBusinessTypeAPI(data) {
|
|||
// 业务类型管理 - 修改
|
||||
export function updateBusinessTypeAPI(data) {
|
||||
return request({
|
||||
url: '/basic/businessType',
|
||||
method: 'put',
|
||||
url: '/planMajor/updatePlanMajor',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
// 业务类型管理 - 删除
|
||||
export function delBusinessTypeAPI(id) {
|
||||
export function delBusinessTypeAPI(data) {
|
||||
return request({
|
||||
url: `/basic/businessType/${id}`,
|
||||
method: 'delete',
|
||||
url: `/planMajor/delPlanMajor`,
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,25 +3,17 @@ import request from '@/utils/request'
|
|||
// 计划类别管理 - 查询列表
|
||||
export function listPlanCategoryAPI(query) {
|
||||
return request({
|
||||
url: '/basic/planCategory/list',
|
||||
method: 'get',
|
||||
url: '/planMajor/getPlanMajorList',
|
||||
method: 'GET',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
// 计划类别管理 - 查询详情
|
||||
export function getPlanCategoryAPI(id) {
|
||||
return request({
|
||||
url: `/basic/planCategory/${id}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 计划类别管理 - 新增
|
||||
export function addPlanCategoryAPI(data) {
|
||||
return request({
|
||||
url: '/basic/planCategory',
|
||||
method: 'post',
|
||||
url: '/planMajor/addPlanMajor',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
@ -29,16 +21,17 @@ export function addPlanCategoryAPI(data) {
|
|||
// 计划类别管理 - 修改
|
||||
export function updatePlanCategoryAPI(data) {
|
||||
return request({
|
||||
url: '/basic/planCategory',
|
||||
method: 'put',
|
||||
url: '/planMajor/updatePlanMajor',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
// 计划类别管理 - 删除
|
||||
export function delPlanCategoryAPI(id) {
|
||||
export function delPlanCategoryAPI(data) {
|
||||
return request({
|
||||
url: `/basic/planCategory/${id}`,
|
||||
method: 'delete',
|
||||
url: `/planMajor/delPlanMajor`,
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,25 +3,17 @@ import request from '@/utils/request'
|
|||
// 计划专业管理 - 查询列表
|
||||
export function listPlanProfessionalAPI(query) {
|
||||
return request({
|
||||
url: '/basic/planProfessional/list',
|
||||
method: 'get',
|
||||
url: '/planMajor/getPlanMajorList',
|
||||
method: 'GET',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
// 计划专业管理 - 查询详情
|
||||
export function getPlanProfessionalAPI(id) {
|
||||
return request({
|
||||
url: `/basic/planProfessional/${id}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 计划专业管理 - 新增
|
||||
export function addPlanProfessionalAPI(data) {
|
||||
return request({
|
||||
url: '/basic/planProfessional',
|
||||
method: 'post',
|
||||
url: '/planMajor/addPlanMajor',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
@ -29,16 +21,17 @@ export function addPlanProfessionalAPI(data) {
|
|||
// 计划专业管理 - 修改
|
||||
export function updatePlanProfessionalAPI(data) {
|
||||
return request({
|
||||
url: '/basic/planProfessional',
|
||||
method: 'put',
|
||||
url: '/planMajor/updatePlanMajor',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
// 计划专业管理 - 删除
|
||||
export function delPlanProfessionalAPI(id) {
|
||||
export function delPlanProfessionalAPI(data) {
|
||||
return request({
|
||||
url: `/basic/planProfessional/${id}`,
|
||||
method: 'delete',
|
||||
url: `/planMajor/delPlanMajor`,
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,25 +3,17 @@ import request from '@/utils/request'
|
|||
// 工作量类别管理 - 查询列表
|
||||
export function listWorkloadCategoryAPI(query) {
|
||||
return request({
|
||||
url: '/basic/workloadCategory/list',
|
||||
method: 'get',
|
||||
url: '/workloadCategory/getWorkloadCategoryList',
|
||||
method: 'GET',
|
||||
params: query,
|
||||
})
|
||||
}
|
||||
|
||||
// 工作量类别管理 - 查询详情
|
||||
export function getWorkloadCategoryAPI(id) {
|
||||
return request({
|
||||
url: `/basic/workloadCategory/${id}`,
|
||||
method: 'get',
|
||||
})
|
||||
}
|
||||
|
||||
// 工作量类别管理 - 新增
|
||||
export function addWorkloadCategoryAPI(data) {
|
||||
return request({
|
||||
url: '/basic/workloadCategory',
|
||||
method: 'post',
|
||||
url: '/workloadCategory/addWorkloadCategory',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
@ -29,16 +21,17 @@ export function addWorkloadCategoryAPI(data) {
|
|||
// 工作量类别管理 - 修改
|
||||
export function updateWorkloadCategoryAPI(data) {
|
||||
return request({
|
||||
url: '/basic/workloadCategory',
|
||||
method: 'put',
|
||||
url: '/workloadCategory/updateWorkloadCategory',
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
||||
// 工作量类别管理 - 删除
|
||||
export function delWorkloadCategoryAPI(id) {
|
||||
export function delWorkloadCategoryAPI(data) {
|
||||
return request({
|
||||
url: `/basic/workloadCategory/${id}`,
|
||||
method: 'delete',
|
||||
url: `/workloadCategory/delWorkloadCategory`,
|
||||
method: 'POST',
|
||||
data,
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,147 +5,157 @@
|
|||
|
||||
// 日期格式化
|
||||
export function parseTime(time, pattern) {
|
||||
if (arguments.length === 0 || !time) {
|
||||
return null
|
||||
}
|
||||
const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
|
||||
let date
|
||||
if (typeof time === 'object') {
|
||||
date = time
|
||||
} else {
|
||||
if ((typeof time === 'string') && (/^[0-9]+$/.test(time))) {
|
||||
time = parseInt(time)
|
||||
} else if (typeof time === 'string') {
|
||||
time = time.replace(new RegExp(/-/gm), '/').replace('T', ' ').replace(new RegExp(/\.[\d]{3}/gm), '')
|
||||
if (arguments.length === 0 || !time) {
|
||||
return null
|
||||
}
|
||||
if ((typeof time === 'number') && (time.toString().length === 10)) {
|
||||
time = time * 1000
|
||||
const format = pattern || '{y}-{m}-{d} {h}:{i}:{s}'
|
||||
let date
|
||||
if (typeof time === 'object') {
|
||||
date = time
|
||||
} else {
|
||||
if (typeof time === 'string' && /^[0-9]+$/.test(time)) {
|
||||
time = parseInt(time)
|
||||
} else if (typeof time === 'string') {
|
||||
time = time
|
||||
.replace(new RegExp(/-/gm), '/')
|
||||
.replace('T', ' ')
|
||||
.replace(new RegExp(/\.[\d]{3}/gm), '')
|
||||
}
|
||||
if (typeof time === 'number' && time.toString().length === 10) {
|
||||
time = time * 1000
|
||||
}
|
||||
date = new Date(time)
|
||||
}
|
||||
date = new Date(time)
|
||||
}
|
||||
const formatObj = {
|
||||
y: date.getFullYear(),
|
||||
m: date.getMonth() + 1,
|
||||
d: date.getDate(),
|
||||
h: date.getHours(),
|
||||
i: date.getMinutes(),
|
||||
s: date.getSeconds(),
|
||||
a: date.getDay()
|
||||
}
|
||||
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
|
||||
let value = formatObj[key]
|
||||
// Note: getDay() returns 0 on Sunday
|
||||
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value] }
|
||||
if (result.length > 0 && value < 10) {
|
||||
value = '0' + value
|
||||
const formatObj = {
|
||||
y: date.getFullYear(),
|
||||
m: date.getMonth() + 1,
|
||||
d: date.getDate(),
|
||||
h: date.getHours(),
|
||||
i: date.getMinutes(),
|
||||
s: date.getSeconds(),
|
||||
a: date.getDay(),
|
||||
}
|
||||
return value || 0
|
||||
})
|
||||
return time_str
|
||||
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
|
||||
let value = formatObj[key]
|
||||
// Note: getDay() returns 0 on Sunday
|
||||
if (key === 'a') {
|
||||
return ['日', '一', '二', '三', '四', '五', '六'][value]
|
||||
}
|
||||
if (result.length > 0 && value < 10) {
|
||||
value = '0' + value
|
||||
}
|
||||
return value || 0
|
||||
})
|
||||
return time_str
|
||||
}
|
||||
|
||||
// 表单重置
|
||||
export function resetForm(refName) {
|
||||
if (this.$refs[refName]) {
|
||||
this.$refs[refName].resetFields()
|
||||
}
|
||||
if (this.$refs[refName]) {
|
||||
this.$refs[refName].resetFields()
|
||||
}
|
||||
}
|
||||
|
||||
// 添加日期范围
|
||||
export function addDateRange(params, dateRange, propName) {
|
||||
let search = params
|
||||
search.params = typeof (search.params) === 'object' && search.params !== null && !Array.isArray(search.params) ? search.params : {}
|
||||
dateRange = Array.isArray(dateRange) ? dateRange : []
|
||||
if (typeof (propName) === 'undefined') {
|
||||
search.params['beginTime'] = dateRange[0]
|
||||
search.params['endTime'] = dateRange[1]
|
||||
} else {
|
||||
search.params['begin' + propName] = dateRange[0]
|
||||
search.params['end' + propName] = dateRange[1]
|
||||
}
|
||||
return search
|
||||
let search = params
|
||||
search.params =
|
||||
typeof search.params === 'object' && search.params !== null && !Array.isArray(search.params)
|
||||
? search.params
|
||||
: {}
|
||||
dateRange = Array.isArray(dateRange) ? dateRange : []
|
||||
if (typeof propName === 'undefined') {
|
||||
search.params['beginTime'] = dateRange[0]
|
||||
search.params['endTime'] = dateRange[1]
|
||||
} else {
|
||||
search.params['begin' + propName] = dateRange[0]
|
||||
search.params['end' + propName] = dateRange[1]
|
||||
}
|
||||
return search
|
||||
}
|
||||
|
||||
// 回显数据字典
|
||||
export function selectDictLabel(datas, value) {
|
||||
if (value === undefined) {
|
||||
return ""
|
||||
}
|
||||
var actions = []
|
||||
Object.keys(datas).some((key) => {
|
||||
if (datas[key].value == ('' + value)) {
|
||||
actions.push(datas[key].label)
|
||||
return true
|
||||
if (value === undefined) {
|
||||
return ''
|
||||
}
|
||||
})
|
||||
if (actions.length === 0) {
|
||||
actions.push(value)
|
||||
}
|
||||
return actions.join('')
|
||||
var actions = []
|
||||
Object.keys(datas).some((key) => {
|
||||
if (datas[key].value == '' + value) {
|
||||
actions.push(datas[key].label)
|
||||
return true
|
||||
}
|
||||
})
|
||||
if (actions.length === 0) {
|
||||
actions.push(value)
|
||||
}
|
||||
return actions.join('')
|
||||
}
|
||||
|
||||
// 回显数据字典(字符串、数组)
|
||||
export function selectDictLabels(datas, value, separator) {
|
||||
if (value === undefined || value.length ===0) {
|
||||
return ""
|
||||
}
|
||||
if (Array.isArray(value)) {
|
||||
value = value.join(",")
|
||||
}
|
||||
var actions = []
|
||||
var currentSeparator = undefined === separator ? "," : separator
|
||||
var temp = value.split(currentSeparator)
|
||||
Object.keys(value.split(currentSeparator)).some((val) => {
|
||||
var match = false
|
||||
Object.keys(datas).some((key) => {
|
||||
if (datas[key].value == ('' + temp[val])) {
|
||||
actions.push(datas[key].label + currentSeparator)
|
||||
match = true
|
||||
}
|
||||
})
|
||||
if (!match) {
|
||||
actions.push(temp[val] + currentSeparator)
|
||||
if (value === undefined || value.length === 0) {
|
||||
return ''
|
||||
}
|
||||
})
|
||||
return actions.join('').substring(0, actions.join('').length - 1)
|
||||
if (Array.isArray(value)) {
|
||||
value = value.join(',')
|
||||
}
|
||||
var actions = []
|
||||
var currentSeparator = undefined === separator ? ',' : separator
|
||||
var temp = value.split(currentSeparator)
|
||||
Object.keys(value.split(currentSeparator)).some((val) => {
|
||||
var match = false
|
||||
Object.keys(datas).some((key) => {
|
||||
if (datas[key].value == '' + temp[val]) {
|
||||
actions.push(datas[key].label + currentSeparator)
|
||||
match = true
|
||||
}
|
||||
})
|
||||
if (!match) {
|
||||
actions.push(temp[val] + currentSeparator)
|
||||
}
|
||||
})
|
||||
return actions.join('').substring(0, actions.join('').length - 1)
|
||||
}
|
||||
|
||||
// 字符串格式化(%s )
|
||||
export function sprintf(str) {
|
||||
var args = arguments, flag = true, i = 1
|
||||
str = str.replace(/%s/g, function () {
|
||||
var arg = args[i++]
|
||||
if (typeof arg === 'undefined') {
|
||||
flag = false
|
||||
return ''
|
||||
}
|
||||
return arg
|
||||
})
|
||||
return flag ? str : ''
|
||||
var args = arguments,
|
||||
flag = true,
|
||||
i = 1
|
||||
str = str.replace(/%s/g, function () {
|
||||
var arg = args[i++]
|
||||
if (typeof arg === 'undefined') {
|
||||
flag = false
|
||||
return ''
|
||||
}
|
||||
return arg
|
||||
})
|
||||
return flag ? str : ''
|
||||
}
|
||||
|
||||
// 转换字符串,undefined,null等转化为""
|
||||
export function parseStrEmpty(str) {
|
||||
if (!str || str == "undefined" || str == "null") {
|
||||
return ""
|
||||
}
|
||||
return str
|
||||
if (!str || str == 'undefined' || str == 'null') {
|
||||
return ''
|
||||
}
|
||||
return str
|
||||
}
|
||||
|
||||
// 数据合并
|
||||
export function mergeRecursive(source, target) {
|
||||
for (var p in target) {
|
||||
try {
|
||||
if (target[p].constructor == Object) {
|
||||
source[p] = mergeRecursive(source[p], target[p])
|
||||
} else {
|
||||
source[p] = target[p]
|
||||
}
|
||||
} catch (e) {
|
||||
source[p] = target[p]
|
||||
for (var p in target) {
|
||||
try {
|
||||
if (target[p].constructor == Object) {
|
||||
source[p] = mergeRecursive(source[p], target[p])
|
||||
} else {
|
||||
source[p] = target[p]
|
||||
}
|
||||
} catch (e) {
|
||||
source[p] = target[p]
|
||||
}
|
||||
}
|
||||
}
|
||||
return source
|
||||
return source
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -156,73 +166,129 @@ export function mergeRecursive(source, target) {
|
|||
* @param {*} children 孩子节点字段 默认 'children'
|
||||
*/
|
||||
export function handleTree(data, id, parentId, children) {
|
||||
let config = {
|
||||
id: id || 'id',
|
||||
parentId: parentId || 'parentId',
|
||||
childrenList: children || 'children'
|
||||
}
|
||||
|
||||
var childrenListMap = {}
|
||||
var tree = []
|
||||
for (let d of data) {
|
||||
let id = d[config.id]
|
||||
childrenListMap[id] = d
|
||||
if (!d[config.childrenList]) {
|
||||
d[config.childrenList] = []
|
||||
let config = {
|
||||
id: id || 'id',
|
||||
parentId: parentId || 'parentId',
|
||||
childrenList: children || 'children',
|
||||
}
|
||||
}
|
||||
|
||||
for (let d of data) {
|
||||
let parentId = d[config.parentId]
|
||||
let parentObj = childrenListMap[parentId]
|
||||
if (!parentObj) {
|
||||
tree.push(d)
|
||||
} else {
|
||||
parentObj[config.childrenList].push(d)
|
||||
var childrenListMap = {}
|
||||
var tree = []
|
||||
for (let d of data) {
|
||||
let id = d[config.id]
|
||||
childrenListMap[id] = d
|
||||
if (!d[config.childrenList]) {
|
||||
d[config.childrenList] = []
|
||||
}
|
||||
}
|
||||
}
|
||||
return tree
|
||||
|
||||
for (let d of data) {
|
||||
let parentId = d[config.parentId]
|
||||
let parentObj = childrenListMap[parentId]
|
||||
if (!parentObj) {
|
||||
tree.push(d)
|
||||
} else {
|
||||
parentObj[config.childrenList].push(d)
|
||||
}
|
||||
}
|
||||
return tree
|
||||
}
|
||||
|
||||
/**
|
||||
* 参数处理
|
||||
* @param {*} params 参数
|
||||
*/
|
||||
* 参数处理
|
||||
* @param {*} params 参数
|
||||
*/
|
||||
export function tansParams(params) {
|
||||
let result = ''
|
||||
for (const propName of Object.keys(params)) {
|
||||
const value = params[propName]
|
||||
var part = encodeURIComponent(propName) + "="
|
||||
if (value !== null && value !== "" && typeof (value) !== "undefined") {
|
||||
if (typeof value === 'object') {
|
||||
for (const key of Object.keys(value)) {
|
||||
if (value[key] !== null && value[key] !== "" && typeof (value[key]) !== 'undefined') {
|
||||
let params = propName + '[' + key + ']'
|
||||
var subPart = encodeURIComponent(params) + "="
|
||||
result += subPart + encodeURIComponent(value[key]) + "&"
|
||||
}
|
||||
let result = ''
|
||||
for (const propName of Object.keys(params)) {
|
||||
const value = params[propName]
|
||||
var part = encodeURIComponent(propName) + '='
|
||||
if (value !== null && value !== '' && typeof value !== 'undefined') {
|
||||
if (typeof value === 'object') {
|
||||
for (const key of Object.keys(value)) {
|
||||
if (
|
||||
value[key] !== null &&
|
||||
value[key] !== '' &&
|
||||
typeof value[key] !== 'undefined'
|
||||
) {
|
||||
let params = propName + '[' + key + ']'
|
||||
var subPart = encodeURIComponent(params) + '='
|
||||
result += subPart + encodeURIComponent(value[key]) + '&'
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result += part + encodeURIComponent(value) + '&'
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result += part + encodeURIComponent(value) + "&"
|
||||
}
|
||||
}
|
||||
}
|
||||
return result
|
||||
return result
|
||||
}
|
||||
|
||||
// 返回项目路径
|
||||
export function getNormalPath(p) {
|
||||
if (p.length === 0 || !p || p == 'undefined') {
|
||||
return p
|
||||
}
|
||||
let res = p.replace('//', '/')
|
||||
if (res[res.length - 1] === '/') {
|
||||
return res.slice(0, res.length - 1)
|
||||
}
|
||||
return res
|
||||
if (p.length === 0 || !p || p == 'undefined') {
|
||||
return p
|
||||
}
|
||||
let res = p.replace('//', '/')
|
||||
if (res[res.length - 1] === '/') {
|
||||
return res.slice(0, res.length - 1)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
// 验证是否为blob格式
|
||||
export function blobValidate(data) {
|
||||
return data.type !== 'application/json'
|
||||
return data.type !== 'application/json'
|
||||
}
|
||||
|
||||
/**
|
||||
* 元转分(用于提交数据到后端)
|
||||
* 使用字符串处理避免浮点数精度问题
|
||||
* @param {number|string} yuan 金额(元)
|
||||
* @returns {number} 金额(分)
|
||||
*/
|
||||
export function yuanToFen(yuan) {
|
||||
if (yuan === null || yuan === undefined || yuan === '') {
|
||||
return 0
|
||||
}
|
||||
// 转换为字符串处理,避免浮点数精度问题
|
||||
const yuanStr = String(yuan)
|
||||
const parts = yuanStr.split('.')
|
||||
const intPart = parts[0] || '0'
|
||||
let decPart = parts[1] || ''
|
||||
|
||||
// 补齐或截取小数部分到2位
|
||||
decPart = (decPart + '00').substring(0, 2)
|
||||
|
||||
// 合并整数部分和小数部分,转为整数(分)
|
||||
return parseInt(intPart + decPart, 10)
|
||||
}
|
||||
|
||||
/**
|
||||
* 分转元(用于显示/回显数据)
|
||||
* 使用字符串处理避免浮点数精度问题
|
||||
* @param {number|string} fen 金额(分)
|
||||
* @returns {number} 金额(元)
|
||||
*/
|
||||
export function fenToYuan(fen) {
|
||||
if (fen === null || fen === undefined || fen === '') {
|
||||
return 0
|
||||
}
|
||||
// 转换为整数
|
||||
const fenNum = parseInt(fen, 10)
|
||||
if (isNaN(fenNum)) {
|
||||
return 0
|
||||
}
|
||||
|
||||
const isNegative = fenNum < 0
|
||||
const absFen = Math.abs(fenNum)
|
||||
// 至少3位,确保能分出整数和小数部分
|
||||
const fenStr = String(absFen).padStart(3, '0')
|
||||
|
||||
// 通过字符串截取分离整数和小数部分
|
||||
const intPart = fenStr.slice(0, -2) || '0'
|
||||
const decPart = fenStr.slice(-2)
|
||||
|
||||
const result = parseFloat(intPart + '.' + decPart)
|
||||
return isNegative ? -result : result
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
import { reactive } from 'vue'
|
||||
export default {
|
||||
formColumns: [
|
||||
{
|
||||
type: 'input',
|
||||
prop: 'planMajorName',
|
||||
placeholder: '请输入业务类型名称',
|
||||
},
|
||||
],
|
||||
tableColumns: [
|
||||
{
|
||||
prop: 'planMajorName',
|
||||
label: '业务类型名称',
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '备注',
|
||||
},
|
||||
],
|
||||
|
||||
dialogConfig: reactive({
|
||||
outerVisible: false,
|
||||
outerTitle: '新增业务类型',
|
||||
outerWidth: '720px',
|
||||
minHeight: '320px',
|
||||
maxHeight: '80vh',
|
||||
}),
|
||||
}
|
||||
|
|
@ -1,10 +1,156 @@
|
|||
<template>
|
||||
<div>
|
||||
<h1>业务类型管理</h1>
|
||||
<div class="app-container">
|
||||
<!-- 业务类型管理 -->
|
||||
<ComTable
|
||||
ref="comTableRef"
|
||||
:form-columns="formColumns"
|
||||
:table-columns="tableColumns"
|
||||
:load-data="listBusinessTypeAPI"
|
||||
:show-toolbar="true"
|
||||
:show-action="true"
|
||||
:action-columns="actionColumns"
|
||||
:default-query-params="{
|
||||
category: 1, // 0:计划专业 1:业务类型 2:计划类别
|
||||
}"
|
||||
>
|
||||
<!-- 工具栏插槽 -->
|
||||
<template #toolbar>
|
||||
<ComButton type="primary" icon="Plus" @click="onHandleAdd">新建业务类型</ComButton>
|
||||
</template>
|
||||
</ComTable>
|
||||
|
||||
<ComDialog :dialog-config="dialogConfig" @closeDialogOuter="onCloseDialogOuter">
|
||||
<template #outerContent>
|
||||
<el-form
|
||||
size="large"
|
||||
label-width="auto"
|
||||
:model="addAndEditForm"
|
||||
ref="addAndEditFormRef"
|
||||
:rules="addAndEditRules"
|
||||
>
|
||||
<el-form-item label="业务类型名称" prop="planMajorName">
|
||||
<el-input
|
||||
clearable
|
||||
placeholder="请输入业务类型名称"
|
||||
v-model.trim="addAndEditForm.planMajorName"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="addAndEditForm.remark" placeholder="请输入备注" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row class="common-btn-row">
|
||||
<ComButton plain type="info" @click="onHandleCancel">取消</ComButton>
|
||||
<ComButton @click="onHandleSave">保存</ComButton>
|
||||
</el-row>
|
||||
</template>
|
||||
</ComDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="BusinessType"></script>
|
||||
<script setup name="Position">
|
||||
import { ref } from 'vue'
|
||||
import {
|
||||
listBusinessTypeAPI,
|
||||
addBusinessTypeAPI,
|
||||
delBusinessTypeAPI,
|
||||
updateBusinessTypeAPI,
|
||||
} from '@/api/basicManage/businessType'
|
||||
import config from './config'
|
||||
import ComTable from '@/components/ComTable/index.vue'
|
||||
import ComButton from '@/components/ComButton/index.vue'
|
||||
import ComDialog from '@/components/ComDialog/index.vue'
|
||||
|
||||
<style></style>
|
||||
const { formColumns, tableColumns, dialogConfig } = config
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const addAndEditFormRef = ref(null)
|
||||
const comTableRef = ref(null)
|
||||
const editId = ref(null)
|
||||
const addAndEditForm = ref({
|
||||
planMajorName: '',
|
||||
remark: '',
|
||||
category: 1,
|
||||
})
|
||||
|
||||
const addAndEditRules = ref({
|
||||
planMajorName: [{ required: true, message: '请输入业务类型名称', trigger: 'blur' }],
|
||||
})
|
||||
|
||||
const actionColumns = [
|
||||
{
|
||||
label: '编辑',
|
||||
type: 'primary',
|
||||
link: true,
|
||||
handler: (row) => {
|
||||
const { planMajorId, planMajorName, remark } = row
|
||||
addAndEditForm.value = {
|
||||
planMajorId,
|
||||
planMajorName,
|
||||
remark,
|
||||
}
|
||||
editId.value = row.planMajorId
|
||||
dialogConfig.outerTitle = '编辑业务类型'
|
||||
dialogConfig.outerVisible = true
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
type: 'danger',
|
||||
link: true,
|
||||
handler: (row) => {
|
||||
proxy.$modal.confirm('是否确认删除该业务类型?').then(async () => {
|
||||
const result = await delBusinessTypeAPI({
|
||||
planMajorId: row.planMajorId,
|
||||
})
|
||||
if (result.code === 200) {
|
||||
proxy.$modal.msgSuccess('删除成功')
|
||||
comTableRef.value?.refresh() // 刷新表格
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
// 新增
|
||||
const onHandleAdd = () => {
|
||||
editId.value = null
|
||||
dialogConfig.outerVisible = true
|
||||
}
|
||||
|
||||
// 取消
|
||||
const onHandleCancel = () => {
|
||||
dialogConfig.outerVisible = false
|
||||
}
|
||||
|
||||
// 保存
|
||||
const onHandleSave = async () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
addAndEditFormRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
const API = editId.value ? updateBusinessTypeAPI : addBusinessTypeAPI
|
||||
const params = JSON.parse(JSON.stringify(addAndEditForm.value))
|
||||
editId.value ? (params.planMajorId = editId.value) : null
|
||||
|
||||
const result = await API(params)
|
||||
if (result.code === 200) {
|
||||
proxy.$modal.msgSuccess(editId.value ? '编辑成功' : '新增成功')
|
||||
addAndEditFormRef.value.resetFields() // 重置表单
|
||||
dialogConfig.outerVisible = false
|
||||
comTableRef.value?.refresh() // 刷新表格
|
||||
}
|
||||
resolve(result)
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
reject()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const onCloseDialogOuter = (visible) => {
|
||||
dialogConfig.outerVisible = visible
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<template #outerContent>
|
||||
<el-form
|
||||
size="large"
|
||||
label-width="100px"
|
||||
label-width="auto"
|
||||
:model="addAndEditForm"
|
||||
ref="addAndEditFormRef"
|
||||
:rules="addAndEditRules"
|
||||
|
|
@ -31,12 +31,21 @@
|
|||
<el-form-item label="运检站名称" prop="inspectionStationName">
|
||||
<el-input
|
||||
clearable
|
||||
maxlength="50"
|
||||
show-word-limit
|
||||
placeholder="请输入运检站名称"
|
||||
v-model.trim="addAndEditForm.inspectionStationName"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="addAndEditForm.remark" placeholder="请输入备注" />
|
||||
<el-input
|
||||
type="textarea"
|
||||
maxlength="200"
|
||||
show-word-limit
|
||||
placeholder="请输入备注"
|
||||
v-model="addAndEditForm.remark"
|
||||
:autosize="{ minRows: 4, maxRows: 8 }"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
|
|
@ -121,6 +130,7 @@ const onHandleAdd = () => {
|
|||
|
||||
// 取消
|
||||
const onHandleCancel = () => {
|
||||
addAndEditFormRef?.value?.resetFields() // 重置表单
|
||||
dialogConfig.outerVisible = false
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<template #outerContent>
|
||||
<el-form
|
||||
size="large"
|
||||
label-width="100px"
|
||||
label-width="auto"
|
||||
:model="addAndEditForm"
|
||||
ref="addAndEditFormRef"
|
||||
:rules="addAndEditRules"
|
||||
|
|
@ -31,12 +31,21 @@
|
|||
<el-form-item label="人员分类名称" prop="personnelClassificationName">
|
||||
<el-input
|
||||
clearable
|
||||
maxlength="50"
|
||||
show-word-limit
|
||||
placeholder="请输入人员分类名称"
|
||||
v-model.trim="addAndEditForm.personnelClassificationName"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="addAndEditForm.remark" placeholder="请输入备注" />
|
||||
<el-input
|
||||
type="textarea"
|
||||
maxlength="200"
|
||||
show-word-limit
|
||||
placeholder="请输入备注"
|
||||
v-model="addAndEditForm.remark"
|
||||
:autosize="{ minRows: 4, maxRows: 8 }"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
|
|
@ -123,6 +132,7 @@ const onHandleAdd = () => {
|
|||
|
||||
// 取消
|
||||
const onHandleCancel = () => {
|
||||
addAndEditFormRef?.value?.resetFields() // 重置表单
|
||||
dialogConfig.outerVisible = false
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -31,12 +31,21 @@
|
|||
<el-form-item label="人员性质名称" prop="personnelClassificationName">
|
||||
<el-input
|
||||
clearable
|
||||
maxlength="50"
|
||||
show-word-limit
|
||||
placeholder="请输入人员性质名称"
|
||||
v-model.trim="addAndEditForm.personnelClassificationName"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="addAndEditForm.remark" placeholder="请输入备注" />
|
||||
<el-input
|
||||
type="textarea"
|
||||
maxlength="200"
|
||||
show-word-limit
|
||||
placeholder="请输入备注"
|
||||
v-model="addAndEditForm.remark"
|
||||
:autosize="{ minRows: 4, maxRows: 8 }"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
|
|
@ -123,6 +132,7 @@ const onHandleAdd = () => {
|
|||
|
||||
// 取消
|
||||
const onHandleCancel = () => {
|
||||
addAndEditFormRef?.value?.resetFields() // 重置表单
|
||||
dialogConfig.outerVisible = false
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
import { reactive } from 'vue'
|
||||
export default {
|
||||
formColumns: [
|
||||
{
|
||||
type: 'input',
|
||||
prop: 'planMajorName',
|
||||
placeholder: '请输入业务类型名称',
|
||||
},
|
||||
],
|
||||
tableColumns: [
|
||||
{
|
||||
prop: 'planMajorName',
|
||||
label: '业务类型名称',
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '备注',
|
||||
},
|
||||
],
|
||||
|
||||
dialogConfig: reactive({
|
||||
outerVisible: false,
|
||||
outerTitle: '新增业务类型',
|
||||
outerWidth: '720px',
|
||||
minHeight: '320px',
|
||||
maxHeight: '80vh',
|
||||
}),
|
||||
}
|
||||
|
|
@ -1,9 +1,166 @@
|
|||
<template>
|
||||
<div>
|
||||
<h1>计划类别管理</h1>
|
||||
<div class="app-container">
|
||||
<!-- 计划类别管理 -->
|
||||
<ComTable
|
||||
ref="comTableRef"
|
||||
:form-columns="formColumns"
|
||||
:table-columns="tableColumns"
|
||||
:load-data="listPlanCategoryAPI"
|
||||
:show-toolbar="true"
|
||||
:show-action="true"
|
||||
:action-columns="actionColumns"
|
||||
:default-query-params="{
|
||||
category: 2, // 0:计划专业 1:业务类型 2:计划类别
|
||||
}"
|
||||
>
|
||||
<!-- 工具栏插槽 -->
|
||||
<template #toolbar>
|
||||
<ComButton type="primary" icon="Plus" @click="onHandleAdd">新建计划类别</ComButton>
|
||||
</template>
|
||||
</ComTable>
|
||||
|
||||
<ComDialog :dialog-config="dialogConfig" @closeDialogOuter="onCloseDialogOuter">
|
||||
<template #outerContent>
|
||||
<el-form
|
||||
size="large"
|
||||
label-width="auto"
|
||||
:model="addAndEditForm"
|
||||
ref="addAndEditFormRef"
|
||||
:rules="addAndEditRules"
|
||||
>
|
||||
<el-form-item label="计划类别名称" prop="planMajorName">
|
||||
<el-input
|
||||
clearable
|
||||
maxlength="50"
|
||||
show-word-limit
|
||||
placeholder="请输入计划类别名称"
|
||||
v-model.trim="addAndEditForm.planMajorName"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
type="textarea"
|
||||
maxlength="200"
|
||||
show-word-limit
|
||||
placeholder="请输入备注"
|
||||
v-model="addAndEditForm.remark"
|
||||
:autosize="{ minRows: 4, maxRows: 8 }"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row class="common-btn-row">
|
||||
<ComButton plain type="info" @click="onHandleCancel">取消</ComButton>
|
||||
<ComButton @click="onHandleSave">保存</ComButton>
|
||||
</el-row>
|
||||
</template>
|
||||
</ComDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="PlanCategory"></script>
|
||||
<script setup name="Position">
|
||||
import { ref } from 'vue'
|
||||
import {
|
||||
listPlanCategoryAPI,
|
||||
addPlanCategoryAPI,
|
||||
delPlanCategoryAPI,
|
||||
updatePlanCategoryAPI,
|
||||
} from '@/api/basicManage/planCategory.js'
|
||||
import config from './config'
|
||||
import ComTable from '@/components/ComTable/index.vue'
|
||||
import ComButton from '@/components/ComButton/index.vue'
|
||||
import ComDialog from '@/components/ComDialog/index.vue'
|
||||
|
||||
<style></style>
|
||||
const { formColumns, tableColumns, dialogConfig } = config
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const addAndEditFormRef = ref(null)
|
||||
const comTableRef = ref(null)
|
||||
const editId = ref(null)
|
||||
const addAndEditForm = ref({
|
||||
planMajorName: '',
|
||||
remark: '',
|
||||
category: 2,
|
||||
})
|
||||
|
||||
const addAndEditRules = ref({
|
||||
planMajorName: [{ required: true, message: '请输入计划类别名称', trigger: 'blur' }],
|
||||
})
|
||||
|
||||
const actionColumns = [
|
||||
{
|
||||
label: '编辑',
|
||||
type: 'primary',
|
||||
link: true,
|
||||
handler: (row) => {
|
||||
const { planMajorId, planMajorName, remark } = row
|
||||
addAndEditForm.value = {
|
||||
planMajorId,
|
||||
planMajorName,
|
||||
remark,
|
||||
}
|
||||
editId.value = row.planMajorId
|
||||
dialogConfig.outerTitle = '编辑计划类别'
|
||||
dialogConfig.outerVisible = true
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
type: 'danger',
|
||||
link: true,
|
||||
handler: (row) => {
|
||||
proxy.$modal.confirm('是否确认删除该计划类别?').then(async () => {
|
||||
const result = await delPlanCategoryAPI({
|
||||
planMajorId: row.planMajorId,
|
||||
})
|
||||
if (result.code === 200) {
|
||||
proxy.$modal.msgSuccess('删除成功')
|
||||
comTableRef.value?.refresh() // 刷新表格
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
// 新增
|
||||
const onHandleAdd = () => {
|
||||
editId.value = null
|
||||
dialogConfig.outerVisible = true
|
||||
}
|
||||
|
||||
// 取消
|
||||
const onHandleCancel = () => {
|
||||
addAndEditFormRef?.value?.resetFields() // 重置表单
|
||||
dialogConfig.outerVisible = false
|
||||
}
|
||||
|
||||
// 保存
|
||||
const onHandleSave = async () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
addAndEditFormRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
const API = editId.value ? updatePlanCategoryAPI : addPlanCategoryAPI
|
||||
const params = JSON.parse(JSON.stringify(addAndEditForm.value))
|
||||
editId.value ? (params.planMajorId = editId.value) : null
|
||||
|
||||
const result = await API(params)
|
||||
if (result.code === 200) {
|
||||
proxy.$modal.msgSuccess(editId.value ? '编辑成功' : '新增成功')
|
||||
addAndEditFormRef.value.resetFields() // 重置表单
|
||||
dialogConfig.outerVisible = false
|
||||
comTableRef.value?.refresh() // 刷新表格
|
||||
}
|
||||
resolve(result)
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
reject()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const onCloseDialogOuter = (visible) => {
|
||||
dialogConfig.outerVisible = visible
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
import { reactive } from 'vue'
|
||||
export default {
|
||||
formColumns: [
|
||||
{
|
||||
type: 'input',
|
||||
prop: 'planMajorName',
|
||||
placeholder: '请输入计划专业名称',
|
||||
},
|
||||
],
|
||||
tableColumns: [
|
||||
{
|
||||
prop: 'planMajorName',
|
||||
label: '计划专业名称',
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '备注',
|
||||
},
|
||||
],
|
||||
|
||||
dialogConfig: reactive({
|
||||
outerVisible: false,
|
||||
outerTitle: '新增计划专业',
|
||||
outerWidth: '720px',
|
||||
minHeight: '320px',
|
||||
maxHeight: '80vh',
|
||||
}),
|
||||
}
|
||||
|
|
@ -1,10 +1,166 @@
|
|||
<template>
|
||||
<div>
|
||||
<h1>计划专业管理</h1>
|
||||
<div class="app-container">
|
||||
<!-- 计划专业管理 -->
|
||||
<ComTable
|
||||
ref="comTableRef"
|
||||
:form-columns="formColumns"
|
||||
:table-columns="tableColumns"
|
||||
:load-data="listPlanProfessionalAPI"
|
||||
:show-toolbar="true"
|
||||
:show-action="true"
|
||||
:action-columns="actionColumns"
|
||||
:default-query-params="{
|
||||
category: 0, // 0:计划专业 1:业务类型 2:计划类别
|
||||
}"
|
||||
>
|
||||
<!-- 工具栏插槽 -->
|
||||
<template #toolbar>
|
||||
<ComButton type="primary" icon="Plus" @click="onHandleAdd">新建计划专业</ComButton>
|
||||
</template>
|
||||
</ComTable>
|
||||
|
||||
<ComDialog :dialog-config="dialogConfig" @closeDialogOuter="onCloseDialogOuter">
|
||||
<template #outerContent>
|
||||
<el-form
|
||||
size="large"
|
||||
label-width="auto"
|
||||
:model="addAndEditForm"
|
||||
ref="addAndEditFormRef"
|
||||
:rules="addAndEditRules"
|
||||
>
|
||||
<el-form-item label="计划专业名称" prop="planMajorName">
|
||||
<el-input
|
||||
clearable
|
||||
maxlength="50"
|
||||
show-word-limit
|
||||
placeholder="请输入计划专业名称"
|
||||
v-model.trim="addAndEditForm.planMajorName"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
type="textarea"
|
||||
maxlength="200"
|
||||
show-word-limit
|
||||
placeholder="请输入备注"
|
||||
v-model="addAndEditForm.remark"
|
||||
:autosize="{ minRows: 4, maxRows: 8 }"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row class="common-btn-row">
|
||||
<ComButton plain type="info" @click="onHandleCancel">取消</ComButton>
|
||||
<ComButton @click="onHandleSave">保存</ComButton>
|
||||
</el-row>
|
||||
</template>
|
||||
</ComDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="PlanProfessional"></script>
|
||||
<script setup name="Position">
|
||||
import { ref } from 'vue'
|
||||
import {
|
||||
listPlanProfessionalAPI,
|
||||
addPlanProfessionalAPI,
|
||||
delPlanProfessionalAPI,
|
||||
updatePlanProfessionalAPI,
|
||||
} from '@/api/basicManage/planProfessional'
|
||||
import config from './config'
|
||||
import ComTable from '@/components/ComTable/index.vue'
|
||||
import ComButton from '@/components/ComButton/index.vue'
|
||||
import ComDialog from '@/components/ComDialog/index.vue'
|
||||
|
||||
<style></style>
|
||||
const { formColumns, tableColumns, dialogConfig } = config
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const addAndEditFormRef = ref(null)
|
||||
const comTableRef = ref(null)
|
||||
const editId = ref(null)
|
||||
const addAndEditForm = ref({
|
||||
planMajorName: '',
|
||||
remark: '',
|
||||
category: 0,
|
||||
})
|
||||
|
||||
const addAndEditRules = ref({
|
||||
planMajorName: [{ required: true, message: '请输入计划专业名称', trigger: 'blur' }],
|
||||
})
|
||||
|
||||
const actionColumns = [
|
||||
{
|
||||
label: '编辑',
|
||||
type: 'primary',
|
||||
link: true,
|
||||
handler: (row) => {
|
||||
const { planMajorId, planMajorName, remark } = row
|
||||
addAndEditForm.value = {
|
||||
planMajorId,
|
||||
planMajorName,
|
||||
remark,
|
||||
}
|
||||
editId.value = row.planMajorId
|
||||
dialogConfig.outerTitle = '编辑计划专业'
|
||||
dialogConfig.outerVisible = true
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
type: 'danger',
|
||||
link: true,
|
||||
handler: (row) => {
|
||||
proxy.$modal.confirm('是否确认删除该计划专业?').then(async () => {
|
||||
const result = await delPlanProfessionalAPI({
|
||||
planMajorId: row.planMajorId,
|
||||
})
|
||||
if (result.code === 200) {
|
||||
proxy.$modal.msgSuccess('删除成功')
|
||||
comTableRef.value?.refresh() // 刷新表格
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
// 新增
|
||||
const onHandleAdd = () => {
|
||||
editId.value = null
|
||||
dialogConfig.outerVisible = true
|
||||
}
|
||||
|
||||
// 取消
|
||||
const onHandleCancel = () => {
|
||||
addAndEditFormRef?.value?.resetFields() // 重置表单
|
||||
dialogConfig.outerVisible = false
|
||||
}
|
||||
|
||||
// 保存
|
||||
const onHandleSave = async () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
addAndEditFormRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
const API = editId.value ? updatePlanProfessionalAPI : addPlanProfessionalAPI
|
||||
const params = JSON.parse(JSON.stringify(addAndEditForm.value))
|
||||
editId.value ? (params.planMajorId = editId.value) : null
|
||||
|
||||
const result = await API(params)
|
||||
if (result.code === 200) {
|
||||
proxy.$modal.msgSuccess(editId.value ? '编辑成功' : '新增成功')
|
||||
addAndEditFormRef.value.resetFields() // 重置表单
|
||||
dialogConfig.outerVisible = false
|
||||
comTableRef.value?.refresh() // 刷新表格
|
||||
}
|
||||
resolve(result)
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
reject()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const onCloseDialogOuter = (visible) => {
|
||||
dialogConfig.outerVisible = visible
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<template #outerContent>
|
||||
<el-form
|
||||
size="large"
|
||||
label-width="100px"
|
||||
label-width="auto"
|
||||
:model="addAndEditForm"
|
||||
ref="addAndEditFormRef"
|
||||
:rules="addAndEditRules"
|
||||
|
|
@ -31,12 +31,21 @@
|
|||
<el-form-item label="岗位名称" prop="personnelClassificationName">
|
||||
<el-input
|
||||
clearable
|
||||
maxlength="50"
|
||||
show-word-limit
|
||||
placeholder="请输入岗位名称"
|
||||
v-model.trim="addAndEditForm.personnelClassificationName"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="addAndEditForm.remark" placeholder="请输入备注" />
|
||||
<el-input
|
||||
type="textarea"
|
||||
maxlength="200"
|
||||
show-word-limit
|
||||
placeholder="请输入备注"
|
||||
v-model="addAndEditForm.remark"
|
||||
:autosize="{ minRows: 4, maxRows: 8 }"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
|
|
@ -121,6 +130,7 @@ const onHandleAdd = () => {
|
|||
|
||||
// 取消
|
||||
const onHandleCancel = () => {
|
||||
addAndEditFormRef?.value?.resetFields() // 重置表单
|
||||
dialogConfig.outerVisible = false
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
<template #outerContent>
|
||||
<el-form
|
||||
size="large"
|
||||
label-width="100px"
|
||||
label-width="auto"
|
||||
:model="addAndEditForm"
|
||||
ref="addAndEditFormRef"
|
||||
:rules="addAndEditRules"
|
||||
|
|
@ -31,12 +31,21 @@
|
|||
<el-form-item label="项目部名称" prop="inspectionStationName">
|
||||
<el-input
|
||||
clearable
|
||||
maxlength="50"
|
||||
show-word-limit
|
||||
placeholder="请输入项目部名称"
|
||||
v-model.trim="addAndEditForm.inspectionStationName"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input v-model="addAndEditForm.remark" placeholder="请输入备注" />
|
||||
<el-input
|
||||
type="textarea"
|
||||
maxlength="200"
|
||||
show-word-limit
|
||||
placeholder="请输入备注"
|
||||
v-model="addAndEditForm.remark"
|
||||
:autosize="{ minRows: 4, maxRows: 8 }"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
|
|
@ -121,6 +130,7 @@ const onHandleAdd = () => {
|
|||
|
||||
// 取消
|
||||
const onHandleCancel = () => {
|
||||
addAndEditFormRef?.value?.resetFields() // 重置表单
|
||||
dialogConfig.outerVisible = false
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
import { reactive } from 'vue'
|
||||
export default {
|
||||
formColumns: [
|
||||
{
|
||||
type: 'input',
|
||||
prop: 'workloadCategoryName',
|
||||
placeholder: '请输入工作量类别名称',
|
||||
},
|
||||
],
|
||||
tableColumns: [
|
||||
{
|
||||
prop: 'workloadCategoryName',
|
||||
label: '工作量类别名称',
|
||||
},
|
||||
{
|
||||
prop: 'unitPrice',
|
||||
label: '单价',
|
||||
slot: 'unitPrice',
|
||||
},
|
||||
{
|
||||
prop: 'remark',
|
||||
label: '备注',
|
||||
},
|
||||
],
|
||||
|
||||
dialogConfig: reactive({
|
||||
outerVisible: false,
|
||||
outerTitle: '新增工作量类别',
|
||||
outerWidth: '720px',
|
||||
minHeight: '320px',
|
||||
maxHeight: '80vh',
|
||||
}),
|
||||
}
|
||||
|
|
@ -1,10 +1,187 @@
|
|||
<template>
|
||||
<div>
|
||||
<h1>工作量类别管理</h1>
|
||||
<div class="app-container">
|
||||
<!-- 工作量类别管理 -->
|
||||
<ComTable
|
||||
ref="comTableRef"
|
||||
:form-columns="formColumns"
|
||||
:table-columns="tableColumns"
|
||||
:load-data="listWorkloadCategoryAPI"
|
||||
:show-toolbar="true"
|
||||
:show-action="true"
|
||||
:action-columns="actionColumns"
|
||||
>
|
||||
<!-- 工具栏插槽 -->
|
||||
<template #toolbar>
|
||||
<ComButton type="primary" icon="Plus" @click="onHandleAdd">
|
||||
新建工作量类别
|
||||
</ComButton>
|
||||
</template>
|
||||
<!-- 单价列插槽 -->
|
||||
<template #unitPrice="{ row }">
|
||||
<span>¥{{ fenToYuan(row.unitPrice) }}</span>
|
||||
</template>
|
||||
</ComTable>
|
||||
|
||||
<ComDialog :dialog-config="dialogConfig" @closeDialogOuter="onCloseDialogOuter">
|
||||
<template #outerContent>
|
||||
<el-form
|
||||
size="large"
|
||||
label-width="auto"
|
||||
:model="addAndEditForm"
|
||||
ref="addAndEditFormRef"
|
||||
:rules="addAndEditRules"
|
||||
>
|
||||
<el-form-item label="工作量类别名称" prop="workloadCategoryName">
|
||||
<el-input
|
||||
clearable
|
||||
maxlength="50"
|
||||
show-word-limit
|
||||
placeholder="请输入工作量类别名称"
|
||||
v-model.trim="addAndEditForm.workloadCategoryName"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="单价" prop="unitPrice">
|
||||
<el-input-number
|
||||
style="width: 100%"
|
||||
:min="0.1"
|
||||
:max="10000"
|
||||
:precision="2"
|
||||
:step="10"
|
||||
v-model="addAndEditForm.unitPrice"
|
||||
>
|
||||
<template #prefix>
|
||||
<span>¥</span>
|
||||
</template>
|
||||
</el-input-number>
|
||||
</el-form-item>
|
||||
<el-form-item label="备注" prop="remark">
|
||||
<el-input
|
||||
type="textarea"
|
||||
maxlength="200"
|
||||
show-word-limit
|
||||
placeholder="请输入备注"
|
||||
v-model="addAndEditForm.remark"
|
||||
:autosize="{ minRows: 4, maxRows: 8 }"
|
||||
/>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
|
||||
<el-row class="common-btn-row">
|
||||
<ComButton plain type="info" @click="onHandleCancel">取消</ComButton>
|
||||
<ComButton @click="onHandleSave">保存</ComButton>
|
||||
</el-row>
|
||||
</template>
|
||||
</ComDialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup name="WorkloadCategory"></script>
|
||||
<script setup name="Position">
|
||||
import { ref } from 'vue'
|
||||
import {
|
||||
listWorkloadCategoryAPI,
|
||||
addWorkloadCategoryAPI,
|
||||
delWorkloadCategoryAPI,
|
||||
updateWorkloadCategoryAPI,
|
||||
} from '@/api/basicManage/workloadCategory.js'
|
||||
import { yuanToFen, fenToYuan } from '@/utils/ruoyi'
|
||||
import config from './config'
|
||||
import ComTable from '@/components/ComTable/index.vue'
|
||||
import ComButton from '@/components/ComButton/index.vue'
|
||||
import ComDialog from '@/components/ComDialog/index.vue'
|
||||
|
||||
<style></style>
|
||||
const { formColumns, tableColumns, dialogConfig } = config
|
||||
const { proxy } = getCurrentInstance()
|
||||
|
||||
const addAndEditFormRef = ref(null)
|
||||
const comTableRef = ref(null)
|
||||
const editId = ref(null)
|
||||
const addAndEditForm = ref({
|
||||
workloadCategoryName: '',
|
||||
unitPrice: 0.1,
|
||||
remark: '',
|
||||
})
|
||||
|
||||
const addAndEditRules = ref({
|
||||
workloadCategoryName: [{ required: true, message: '请输入工作量类别名称', trigger: 'blur' }],
|
||||
unitPrice: [{ required: true, message: '请输入单价', trigger: 'blur' }],
|
||||
})
|
||||
|
||||
const actionColumns = [
|
||||
{
|
||||
label: '编辑',
|
||||
type: 'primary',
|
||||
link: true,
|
||||
handler: (row) => {
|
||||
const { workloadCategoryId, workloadCategoryName, remark, unitPrice } = row
|
||||
addAndEditForm.value = {
|
||||
workloadCategoryId,
|
||||
workloadCategoryName,
|
||||
unitPrice: fenToYuan(unitPrice), // 分转元回显
|
||||
remark,
|
||||
}
|
||||
editId.value = row.workloadCategoryId
|
||||
dialogConfig.outerTitle = '编辑工作量类别'
|
||||
dialogConfig.outerVisible = true
|
||||
},
|
||||
},
|
||||
{
|
||||
label: '删除',
|
||||
type: 'danger',
|
||||
link: true,
|
||||
handler: (row) => {
|
||||
proxy.$modal.confirm('是否确认删除该工作量类别?').then(async () => {
|
||||
const result = await delWorkloadCategoryAPI({
|
||||
workloadCategoryId: row.workloadCategoryId,
|
||||
})
|
||||
if (result.code === 200) {
|
||||
proxy.$modal.msgSuccess('删除成功')
|
||||
comTableRef.value?.refresh() // 刷新表格
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
// 新增
|
||||
const onHandleAdd = () => {
|
||||
editId.value = null
|
||||
dialogConfig.outerVisible = true
|
||||
}
|
||||
|
||||
// 取消
|
||||
const onHandleCancel = () => {
|
||||
addAndEditFormRef?.value?.resetFields() // 重置表单
|
||||
dialogConfig.outerVisible = false
|
||||
}
|
||||
|
||||
// 保存
|
||||
const onHandleSave = async () => {
|
||||
return new Promise((resolve, reject) => {
|
||||
try {
|
||||
addAndEditFormRef.value.validate(async (valid) => {
|
||||
if (valid) {
|
||||
const API = editId.value ? updateWorkloadCategoryAPI : addWorkloadCategoryAPI
|
||||
const params = JSON.parse(JSON.stringify(addAndEditForm.value))
|
||||
params.unitPrice = yuanToFen(params.unitPrice) // 元转分提交
|
||||
editId.value ? (params.workloadCategoryId = editId.value) : null
|
||||
|
||||
const result = await API(params)
|
||||
if (result.code === 200) {
|
||||
proxy.$modal.msgSuccess(editId.value ? '编辑成功' : '新增成功')
|
||||
addAndEditFormRef.value.resetFields() // 重置表单
|
||||
dialogConfig.outerVisible = false
|
||||
comTableRef.value?.refresh() // 刷新表格
|
||||
}
|
||||
resolve(result)
|
||||
}
|
||||
})
|
||||
} catch (error) {
|
||||
reject()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
const onCloseDialogOuter = (visible) => {
|
||||
dialogConfig.outerVisible = visible
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Reference in New Issue