133 lines
4.6 KiB
Vue
133 lines
4.6 KiB
Vue
<template>
|
|
<Dialog :title="dialogTitle" width="80%" v-model="dialogVisible" center>
|
|
<ContentWrap class="borderxx">
|
|
<!-- 搜索工作栏 -->
|
|
<el-form class="-mb-15px" :model="queryParams" ref="queryFormRef" :inline="true" label-width="108px">
|
|
<el-form-item label="项目编号" prop="code">
|
|
<el-input v-model="queryParams.code" placeholder="请输入项目编号" clearable @keyup.enter="handleQuery" class="!w-240px" />
|
|
</el-form-item>
|
|
<el-form-item label="项目名称" prop="projectName">
|
|
<el-input v-model="queryParams.projectName" placeholder="请输入项目名称" clearable @keyup.enter="handleQuery" class="!w-240px" />
|
|
</el-form-item>
|
|
<el-form-item label="客户名称" prop="customerName">
|
|
<el-input v-model="queryParams.customerName" placeholder="请输入客户名称" clearable @keyup.enter="handleQuery" class="!w-240px" />
|
|
</el-form-item>
|
|
<el-form-item>
|
|
<el-button @click="handleQuery" type="primary">
|
|
<Icon icon="ep:search" class="mr-5px" /> 搜索
|
|
</el-button>
|
|
<el-button @click="resetQuery">
|
|
<Icon icon="ep:refresh" class="mr-5px" /> 重置
|
|
</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
</ContentWrap>
|
|
<el-card class="hl-card">
|
|
<!-- 列表 -->
|
|
<ContentWrap>
|
|
<el-table v-loading="loading" :data="list" :stripe="true" :show-overflow-tooltip="true" class="hl-table" @selection-change="handleCurrentChange" @row-click="clickRow" highlight-current-row ref="singleTable" selection>
|
|
<el-table-column fixed type="selection" width="40" />
|
|
<el-table-column label="序号" type="index" width="100" />
|
|
<el-table-column label="项目编号" align="center" prop="code" width="240" />
|
|
<el-table-column label="项目名称" align="center" prop="projectName" width="220" />
|
|
<el-table-column label="客户名称" align="center" prop="customerName" width="240" />
|
|
<el-table-column label="价格(元)" align="center" prop="price" />
|
|
</el-table>
|
|
<!-- 分页 -->
|
|
<Pagination :total="total" v-model:page="queryParams.pageNo" v-model:limit="queryParams.pageSize" @pagination="getList" />
|
|
</ContentWrap>
|
|
</el-card>
|
|
<template #footer>
|
|
<el-button @click="dialogVisible=false" size="large">取 消</el-button>
|
|
<el-button @click="submitForm" type="success" size="large">确 认</el-button>
|
|
</template>
|
|
</Dialog>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import * as ProjectOrderApi from '@/api/heli/projectorder'
|
|
import { ref } from 'vue'
|
|
import { ElTable } from 'element-plus'
|
|
|
|
const message = useMessage() // 消息弹窗
|
|
const { t } = useI18n() // 国际化
|
|
const router = useRouter()
|
|
const dialogVisible = ref(false) // 弹窗的是否展示
|
|
const dialogTitle = ref('') // 弹窗的标题
|
|
|
|
const loading = ref(true) // 列表的加载中
|
|
const list = ref([]) // 列表的数据
|
|
const total = ref(0) // 列表的总页数
|
|
const queryParams = reactive({
|
|
pageNo: 1,
|
|
pageSize: 10,
|
|
orderStatus: 32,
|
|
isSnapshot: 0,
|
|
projectName: undefined,
|
|
code: undefined,
|
|
customerName: undefined
|
|
})
|
|
const queryFormRef = ref() // 搜索的表单
|
|
|
|
/** 查询列表 */
|
|
const getList = async () => {
|
|
loading.value = true
|
|
try {
|
|
const data = await ProjectOrderApi.getProjectOrderPage(queryParams)
|
|
list.value = data.list
|
|
total.value = data.total
|
|
} finally {
|
|
loading.value = false
|
|
}
|
|
}
|
|
|
|
/** 搜索按钮操作 */
|
|
const handleQuery = () => {
|
|
queryParams.pageNo = 1
|
|
getList()
|
|
}
|
|
|
|
/** 重置按钮操作 */
|
|
const resetQuery = () => {
|
|
queryFormRef.value.resetFields()
|
|
handleQuery()
|
|
}
|
|
const singleTable = ref<InstanceType<typeof ElTable>>()
|
|
|
|
const multipleSelection: any = ref([])
|
|
const handleCurrentChange = (val: []) => {
|
|
if (val.length > 1) {
|
|
singleTable.value.clearSelection()
|
|
singleTable.value.toggleRowSelection(val.pop())
|
|
} else {
|
|
multipleSelection.value = val.pop()
|
|
}
|
|
}
|
|
const clickRow = (row: any) => {
|
|
if (row) {
|
|
singleTable.value!.toggleRowSelection(row, undefined)
|
|
} else {
|
|
singleTable.value!.clearSelection()
|
|
}
|
|
}
|
|
/** 提交表单 */
|
|
const emit = defineEmits(['success']) // 定义 success 事件,用于操作成功后的回调
|
|
const submitForm = () => {
|
|
if (multipleSelection.value.length === 0) {
|
|
message.warning('请选择一条数据')
|
|
return
|
|
}
|
|
dialogVisible.value = false
|
|
// 发送操作成功的事件
|
|
emit('success', multipleSelection.value)
|
|
}
|
|
|
|
/** 打开弹窗 */
|
|
const open = async () => {
|
|
dialogVisible.value = true
|
|
handleQuery()
|
|
}
|
|
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
|
|
</script>
|
|
|