Merge branch 'zth' into dev

szh-new
张同海 2 months ago
commit 493b47efe2

@ -148,7 +148,6 @@ export function formatParams(params = {}, equal: any = [], otherQuery: any = [])
if (params[key] !== undefined) {
let IsContinue = true
if (otherQuery.length) {
postData.otherQueryCondition = {}
otherQuery.forEach((item) => {
if (key == item) {
IsContinue = false
@ -238,6 +237,8 @@ export function formatParams(params = {}, equal: any = [], otherQuery: any = [])
} else {
postData.pageCondition.sortConditions = []
}
console.log(Object.keys(otherQueryCondition));
if (Object.keys(otherQueryCondition).length) {
postData.otherQueryCondition = otherQueryCondition
}

@ -0,0 +1,317 @@
<template>
<BasicModal
v-bind="$attrs"
:use-wrapper="true"
title="批量变动导入_模板管理"
width="55%"
@register="registerModal"
@ok="handleSave"
>
<BasicForm @register="registerForm" />
<div class="HotTable">
<div>
<a-button type="link" @click="TableAdd" class="pl0">
<span class="iconfont icon-new_document"></span>
新增
</a-button>
<a-popconfirm
title="确定要删除所选数据?"
ok-text="确定"
cancel-text="取消"
@confirm="FnClickDel"
>
<a-button type="link" class="pl0">
<span class="iconfont icon-shanchu21"></span>
删除
</a-button>
</a-popconfirm>
<!-- <a-button type="link" @click="handleSave(false)" class="pl0">
<span class="iconfont icon-baocun" v-repeat></span>
保存
</a-button> -->
</div>
<div style="position: relative">
<input
class="ds-tb-check ds-goods-tb-check"
type="checkbox"
v-model="allCheck"
:indeterminate="someCheck"
v-if="list.length !== 0"
/>
<hot-table ref="hotTb" :data="list" :settings="settings">
<img
v-show="!list.length"
class="hot-tb-no-data"
src="../../../assets/images/nodata.png"
alt=""
/>
</hot-table>
</div>
</div>
<!--右下角按钮-->
<template #footer>
<a-button
pre-icon="ant-design:close-outlined"
type="warning"
:loading="loading"
ghost
style="margin-right: 0.8rem"
@click="closeModal"
>取消</a-button
>
<a-button
type="success"
:loading="loading"
pre-icon="ant-design:check-outlined"
style="margin-right: 0.8rem"
@click="handleSave(false)"
>仅保存</a-button
>
<a-button
pre-icon="ant-design:check-circle-outlined"
type="primary"
:loading="loading"
@click="handleSave(true)"
>保存并关闭</a-button
>
</template>
</BasicModal>
</template>
<script lang="ts" setup>
import { ref, watchEffect, watch, unref } from 'vue'
import { BasicModal, useModalInner } from '/@/components/Modal'
import { BasicForm, useForm } from '/@/components/Form/index'
import { formSchema } from './columns'
import { ApiEdit, ApiInfo, ApiDelDetail } from './api'
//
import { getDictOption } from '/@/utils/dictUtil'
import { HotTable } from '@handsontable/vue3'
import { registerAllModules } from 'handsontable/registry'
registerAllModules()
import 'handsontable/dist/handsontable.full.css'
import { useMessage } from '/@/hooks/web/useMessage'
const { notification } = useMessage()
// Emits
const emit = defineEmits(['success', 'register'])
const select = ref([])
const loading = ref(false)
const rowId = ref()
const { createMessage } = useMessage()
const [registerForm, { resetFields, setFieldsValue, validate }] = useForm({
labelWidth: 100,
schemas: formSchema,
showActionButtonGroup: false,
})
const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
resetFields()
setModalProps({ confirmLoading: false, loading: true })
select.value = data.select
if (select.value.length) {
console.log(select.value)
let cntrno = ''
select.value.forEach((item: any) => {
cntrno = cntrno ? `${cntrno},${item.cntrno}` : item.cntrno
})
setFieldsValue({ cntrno })
}
setModalProps({ loading: false })
})
async function handleSave(exit) {
try {
const values = await validate()
setModalProps({ confirmLoading: true, loading: true })
values.bodyList = list.value
const res: API.DataResult = await ApiEdit(values)
if (res.succeeded) {
createMessage.success(res.message)
emit('success')
//
if (!exit) {
rowId.value = res.data
select.value = []
await refresh()
}
} else {
createMessage.error(res.message)
}
exit && closeModal()
} finally {
// loading.value = false;
setModalProps({ confirmLoading: false, loading: false })
}
}
async function refresh() {
const res: API.DataResult = await ApiInfo({ id: unref(rowId) })
if (res.succeeded) {
await setFieldsValue({
...res.data,
})
}
}
// ------------------------
const list = ref<any>([])
//
const allCheck = ref(false)
//
const someCheck = ref(false)
const hotTb = ref()
watchEffect(() => {
//
if (allCheck.value) {
list.value.forEach((item: any) => {
item.selected = true
})
} else {
//
list.value.forEach((item: any) => {
item.selected = false
})
}
})
watch(
list.value,
(val) => {
let a = 0
let b = 0
val.forEach((item: any) => {
if (item.selected) {
a += 1
} else {
b += 1
}
})
if (a == 0) {
allCheck.value = false
}
if (b == 0) {
allCheck.value = true
}
if (a != 0 && b != 0) {
someCheck.value = true
} else {
someCheck.value = false
}
},
{
deep: true,
},
)
const columns = [
{
data: 'selected',
type: 'checkbox',
title: ' ',
width: 32,
className: 'htCenter',
readOnly: false,
},
{
title: '主键Id',
width: 200,
data: 'id',
},
{
title: 'PID',
width: 200,
data: 'pid',
},
{
title: '对应变动字段的标题',
width: 120,
data: 'fieldTitle',
},
{
title: '顺序',
width: 200,
data: 'sortNumber',
},
{
title: '列标题',
width: 120,
data: 'columnTitle',
},
{
title: '对应变动字段',
width: 120,
data: 'fieldName',
type: 'dropdown',
// (process)
source: async (query, process) => {
const results = await getDictOption('CM_StateChange_Field')
const dict = results.map((item) => {
return item.name
})
process(dict)
},
},
]
const settings = {
height: '260',
autoWrapRow: true,
autoWrapCol: true,
//
rowHeights: 26,
fixedColumnsLeft: 1,
//
hiddenColumns: {
columns: [1, 2, 3],
indicators: true,
},
//
enterMoves: 'row',
columnSorting: true,
//
afterValidate: function (isValid, value, row, prop, source) {
if (!isValid) {
hotTb.value.hotInstance.setDataAtRowProp(row, prop, '')
}
},
columns: columns,
// ()
licenseKey: 'non-commercial-and-evaluation',
//
async afterChange(changes, source) {
if (source === 'edit' || source === 'Autofill.fill' || source === 'CopyPaste.paste') {
let dict: any = {}
if (changes[0][1] === 'fieldName') {
const res = await getDictOption('CM_StateChange_Field')
const item = res.filter((item) => {
return item.name === changes[0][3]
})
if (item) dict = item[0]
list.value[changes[0][0]]['fieldName'] = dict?.name
list.value[changes[0][0]]['fieldTitle'] = dict?.value
}
}
},
}
function TableAdd() {
list.value.push({ selected: false })
}
function FnClickDel() {
let ApiData: any = { ids: [] }
list.value.forEach((e: any, i) => {
if (e.selected) {
if (e.id) {
ApiData.ids.push(e.id)
} else {
list.value.splice(i, 1)
}
}
})
if (ApiData.ids.length) {
ApiDelDetail(ApiData).then((res) => {
if (res.succeeded) {
refresh()
notification.success({ message: res.message, duration: 3 })
}
})
}
}
</script>

@ -0,0 +1,53 @@
// @ts-ignore
import { request } from '/@/utils/request'
import { DataResult, PageRequest } from '/@/api/model/baseModel'
enum Api {
list = '/containerManagementApi/CM_State_Change_Templat/GetCM_State_Change_TemplatList',
edit = '/containerManagementApi/CM_State_Change_Templat/EditCM_State_Change_Templat',
info = '/containerManagementApi/CM_State_Change_Templat/GetCM_State_Change_Templat',
del = '/containerManagementApi/CM_State_Change_Templat/DeleteCM_State_Change_Templat',
delDetail = '/containerManagementApi/CM_State_Change_Templat/DeleteCM_State_Change_TemplatDetail',
}
// 列表 (Auth)
export function ApiList(data: PageRequest) {
return request<DataResult>({
url: Api.list,
method: 'post',
data,
})
}
// 编辑 (Auth)
export function ApiEdit(data: PageRequest) {
return request<DataResult>({
url: Api.edit,
method: 'post',
data,
})
}
// 详情 (Auth)
export function ApiInfo(query) {
return request<DataResult>({
url: Api.info,
method: 'get',
params: query,
})
}
// 批量删除 (Auth)
export function ApiDel(data: PageRequest) {
return request<DataResult>({
url: Api.del,
method: 'post',
data,
})
}
// 删除明细 (Auth)
export function ApiDelDetail(data: PageRequest) {
return request<DataResult>({
url: Api.delDetail,
method: 'post',
data,
})
}

@ -0,0 +1,153 @@
import { ref } from 'vue'
import { BasicColumn, FormSchema } from '/@/components/Table'
import { Tag } from 'ant-design-vue'
import { GetCtnSelectList, GetClientListByCode } from '/@/api/common'
import { GetDeptList } from '/@/views/operation/seaexport/api/BookingLedger'
import { useOptionsStore } from '/@/store/modules/options'
const optionsStore = useOptionsStore()
// 字典
import { getDictOption } from '/@/utils/dictUtil'
// 新旧箱数据
const usedStateList = [
{
label: '',
value: '',
},
{
label: 'USED',
value: 'USED',
},
{
label: 'NEW',
value: 'NEW',
},
]
export const columns: BasicColumn[] = [
{
title: '模块名称',
dataIndex: 'formName',
sorter: true,
width: 150,
},
{
title: '模板名称',
dataIndex: 'templetName',
sorter: true,
width: 150,
},
{
title: '录入人',
dataIndex: 'createUserName',
sorter: true,
width: 200,
},
{
title: '录入时间',
dataIndex: 'createTime',
sorter: true,
width: 200,
},
{
title: '备注',
dataIndex: 'remark',
sorter: true,
width: 200,
},
]
export const searchFormSchema: FormSchema[] = [
{
field: 'formName',
label: '模块名称',
component: 'Input',
colProps: { span: 4 },
},
{
field: 'templetName',
label: '模板名称',
component: 'Input',
colProps: { span: 4 },
},
{
field: 'remark',
label: '备注',
component: 'Input',
colProps: { span: 4 },
},
]
export const formSchema: FormSchema[] = [
{
label: '',
field: 'id',
component: 'Input',
defaultValue: '',
show: false,
},
{
label: '模块名称',
field: 'formName',
component: 'Input',
defaultValue: '',
colProps: { span: 6 },
},
{
label: '模板名称',
field: 'templetName',
component: 'Input',
defaultValue: '',
colProps: { span: 6 },
},
{
label: '录入人',
field: 'createUserName',
component: 'Input',
defaultValue: '',
// show: false,
},
// {
// label: '录入人',
// field: 'createUser',
// component: 'ApiSelect',
// required: false,
// dynamicDisabled: false,
// colProps: { span: 6 },
// componentProps: ({ formModel }) => {
// return {
// allowClear: true,
// showSearch: true,
// api: GetClientListByCode,
// params: { code: 'leasing' },
// labelField: 'pinYinCode',
// showName: 'shortName',
// valueField: 'shortName',
// resultField: 'data',
// immediate: false,
// filterOption: (input: string, option: any) => {
// return option.label.toLowerCase().indexOf(input.toLowerCase()) >= 0
// },
// }
// },
// },
{
label: '录入时间',
field: 'createTime',
component: 'DatePicker',
colProps: { span: 6 },
componentProps: {
showTime: false,
style: 'width:100%',
valueFormat: 'YYYY-MM-DD 00:00:00',
},
},
{
field: 'remark',
label: '备注',
component: 'InputTextArea',
// required: true,
colProps: { span: 12 },
componentProps: {
rows: 3,
},
},
]

@ -0,0 +1,96 @@
<template>
<div>
<BasicTable class="ds-table" @register="registerTable">
<template #tableTitle>
<a-button type="link" @click="handleCreate">
<span class="iconfont icon-tianjia"></span>
新建
</a-button>
<a-popconfirm
title="确定删除当前选中数据?"
ok-text="是"
cancel-text="否"
@confirm="handleDel"
>
<a-button type="link">
<span class="iconfont icon-shanchu21"></span>
删除
</a-button>
</a-popconfirm>
</template>
</BasicTable>
<TenantAuditStepModal @register="registerModal" @success="handleSuccess" />
</div>
</template>
<script lang="ts" setup>
import { ref } from 'vue'
import { BasicTable, useTable, TableAction, SorterResult } from '/@/components/Table'
import { ApiList, ApiDel } from './api'
import { useModal } from '/@/components/Modal'
import TenantAuditStepModal from './TenantAuditStepModal.vue'
import { columns, searchFormSchema } from './columns'
import { formatParams } from '/@/hooks/web/common'
import { useMessage } from '/@/hooks/web/useMessage'
const { notification } = useMessage()
const [registerModal, { openModal }] = useModal()
const [registerTable, { reload, getForm, getSelectRows }] = useTable({
title: '批量变动导入_模板管理',
api: async (p) => {
const res: API.DataResult = await ApiList(p)
return new Promise((resolve) => {
resolve({ data: [...res.data], total: res.count })
})
},
beforeFetch: (p) => {
return formatParams(p, ['ctnOwner', 'ctnSourceId', 'isOnlineId', 'portid'])
},
columns,
formConfig: {
labelWidth: 120,
schemas: searchFormSchema,
},
isTreeTable: false,
pagination: true,
striped: true,
useSearchForm: true,
showTableSetting: true,
bordered: true,
showIndexColumn: true,
indexColumnProps: {
width: 60,
},
canResize: true,
resizeHeightOffset: 35,
immediate: true,
})
function handleCreate() {
const select = getSelectRows()
openModal(true, {
isParent: false,
isUpdate: false,
select,
})
}
function handleDel() {
const select = getSelectRows()
let ApiData: any = {
ids: [],
}
if (select.length === 0) {
notification.warning({ message: '请至少选择一条数据', duration: 3 })
return false
} else {
ApiData.ids = select.map((item) => {
return item.id
})
}
ApiDel(ApiData).then((res) => {
notification.success({ message: res.message, duration: 3 })
reload()
})
}
function handleSuccess() {
reload()
}
</script>

@ -75,7 +75,6 @@ export const columns: BasicColumn[] = [
sorter: true,
width: 150,
customRender: ({ text, record }) => {
console.log(text, record)
let RText = ''
RText = text
if (record.auditStatus == 2) {
@ -336,6 +335,7 @@ export const searchFormSchema: FormSchema[] = [
label: '是否合同超期',
component: 'Switch',
colProps: { span: 4 },
defaultValue: false,
componentProps: {
checkedChildren: '是',
checkedValue: true,

Loading…
Cancel
Save