|
@@ -21,13 +21,15 @@
|
|
|
>
|
|
|
<div
|
|
|
class="head-box-item"
|
|
|
- :class="[checkedCities.includes(city) ? 'active' : '']"
|
|
|
- v-for="city in cities"
|
|
|
- :key="city"
|
|
|
+ :class="[
|
|
|
+ checkedCities.includes(type.engineeringType) ? 'active' : '',
|
|
|
+ ]"
|
|
|
+ v-for="type in typeList"
|
|
|
+ :key="type.engineeringType"
|
|
|
>
|
|
|
- <el-checkbox label="" :value="city"></el-checkbox>
|
|
|
- <div class="name">射频类</div>
|
|
|
- <div class="num">99+</div>
|
|
|
+ <el-checkbox label="" :value="type.engineeringType"></el-checkbox>
|
|
|
+ <div class="name">{{ type.engineeringType }}</div>
|
|
|
+ <div class="num">{{ type.typeCount }}</div>
|
|
|
</div>
|
|
|
</el-checkbox-group>
|
|
|
</div>
|
|
@@ -40,14 +42,14 @@
|
|
|
<span class="add">+</span>
|
|
|
新增工程
|
|
|
</el-button>
|
|
|
- <el-button class="active">
|
|
|
- <i />
|
|
|
- 按时间倒序
|
|
|
- </el-button>
|
|
|
- <el-button class="normal">
|
|
|
- <i />
|
|
|
- 按创建人姓名
|
|
|
- </el-button>
|
|
|
+ <!-- <el-button class="active">-->
|
|
|
+ <!-- <i />-->
|
|
|
+ <!-- 按时间倒序-->
|
|
|
+ <!-- </el-button>-->
|
|
|
+ <!-- <el-button class="normal">-->
|
|
|
+ <!-- <i />-->
|
|
|
+ <!-- 按创建人姓名-->
|
|
|
+ <!-- </el-button>-->
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
@@ -60,7 +62,11 @@
|
|
|
<div class="list-item-flex">
|
|
|
<div class="list-itme-tit">{{ item.engineeringProductName }}</div>
|
|
|
<div class="list-item-switch">
|
|
|
- <span class="item-gray">发布</span><el-switch v-model="value" />
|
|
|
+ <span class="item-gray">发布</span
|
|
|
+ ><el-switch
|
|
|
+ v-model="item.publishStatus"
|
|
|
+ @change="changeProjectStatus(item)"
|
|
|
+ />
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="list-item-flex">
|
|
@@ -81,13 +87,31 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="list-item-btns">
|
|
|
- <span @click="showDetailsFun(item)">
|
|
|
+ <span @click="toEdit(item)">
|
|
|
<svg-icon icon-class="homeIcon2" />
|
|
|
</span>
|
|
|
- <span>
|
|
|
- <svg-icon icon-class="homeIcon3" />
|
|
|
- </span>
|
|
|
- <span>
|
|
|
+ <el-popconfirm
|
|
|
+ width="220"
|
|
|
+ :icon="InfoFilled"
|
|
|
+ icon-color="#626AEF"
|
|
|
+ title="确认要删除这个工程吗?"
|
|
|
+ @cancel="onDelCancel"
|
|
|
+ @confirm="deleteConfirm(item)"
|
|
|
+ >
|
|
|
+ <template #reference>
|
|
|
+ <span>
|
|
|
+ <svg-icon icon-class="homeIcon3" />
|
|
|
+ </span>
|
|
|
+ </template>
|
|
|
+ <template #actions="{ confirm, cancel }">
|
|
|
+ <el-button size="small" @click="cancel">取消</el-button>
|
|
|
+ <el-button type="danger" size="small" @click="confirm">
|
|
|
+ 确认删除
|
|
|
+ </el-button>
|
|
|
+ </template>
|
|
|
+ </el-popconfirm>
|
|
|
+
|
|
|
+ <span @click="showDetailsFun(item)">
|
|
|
<svg-icon icon-class="homeIcon4" />
|
|
|
</span>
|
|
|
<span>
|
|
@@ -99,57 +123,62 @@
|
|
|
<el-pagination
|
|
|
class="content-pag"
|
|
|
background
|
|
|
- layout="prev, pager, next"
|
|
|
- :page-size="9"
|
|
|
- :total="1000"
|
|
|
- @change="handleChange"
|
|
|
+ layout="sizes,prev, pager, next"
|
|
|
+ :current-page="currentPage"
|
|
|
+ :page-size="pageSize"
|
|
|
+ :total="total"
|
|
|
+ :page-sizes="[9, 12, 15, 18, 30]"
|
|
|
+ @size-change="handleSizeChange"
|
|
|
+ @current-change="handleCurrentChange"
|
|
|
/>
|
|
|
</div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <AddComponent
|
|
|
- :show="showAdd"
|
|
|
- @handleCancel="showAdd = false"
|
|
|
- @save="saveFun"
|
|
|
- />
|
|
|
+ <AddComponent ref="addRef" @save-finish="getEngineeringList" />
|
|
|
|
|
|
- <DetailsComponent :show="showDetails" @handleCancel="showDetails = false" />
|
|
|
+ <DetailsComponent ref="detailRef" />
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
+import { InfoFilled } from "@element-plus/icons-vue";
|
|
|
import AddComponent from "./components/add.vue";
|
|
|
import DetailsComponent from "./components/details.vue";
|
|
|
|
|
|
import { ref } from "vue";
|
|
|
|
|
|
import type { CheckboxValueType } from "element-plus";
|
|
|
+import {
|
|
|
+ deleteProject,
|
|
|
+ getProjectPage,
|
|
|
+ getProjectTypeCount,
|
|
|
+ updateProject,
|
|
|
+} from "@/api/project";
|
|
|
|
|
|
const checkAll = ref(false);
|
|
|
const isIndeterminate = ref(true);
|
|
|
-const checkedCities = ref(["Shanghai", "Beijing"]);
|
|
|
-const cities = [
|
|
|
- "Shanghai",
|
|
|
- "Beijing",
|
|
|
- "Guangzhou",
|
|
|
- "Shenzhen",
|
|
|
- "1",
|
|
|
- "2",
|
|
|
- "3",
|
|
|
- "4",
|
|
|
-];
|
|
|
+const checkedCities = ref([]);
|
|
|
+const typeList = ref([]);
|
|
|
+// 获取所有的工程类型
|
|
|
+const getEngineeringTypeList = () => {
|
|
|
+ getProjectTypeCount().then((res) => {
|
|
|
+ typeList.value = res.data?.statisticsList ?? [];
|
|
|
+ });
|
|
|
+};
|
|
|
|
|
|
const handleCheckAllChange = (val: CheckboxValueType) => {
|
|
|
- checkedCities.value = val ? cities : [];
|
|
|
+ checkedCities.value = val
|
|
|
+ ? typeList.value.map((item) => item.engineeringType)
|
|
|
+ : [];
|
|
|
isIndeterminate.value = false;
|
|
|
+ getEngineeringList(false);
|
|
|
};
|
|
|
const handleCheckedCitiesChange = (value: CheckboxValueType[]) => {
|
|
|
const checkedCount = value.length;
|
|
|
- checkAll.value = checkedCount === cities.length;
|
|
|
- isIndeterminate.value = checkedCount > 0 && checkedCount < cities.length;
|
|
|
+ checkAll.value = checkedCount === typeList.value.length;
|
|
|
+ isIndeterminate.value =
|
|
|
+ checkedCount > 0 && checkedCount < typeList.value.length;
|
|
|
+ getEngineeringList(false);
|
|
|
};
|
|
|
|
|
|
-const value = ref(true);
|
|
|
-
|
|
|
interface VersionItem {
|
|
|
id: string; // 主键 string
|
|
|
engineeringProductName: string; // 产品名称 string
|
|
@@ -162,93 +191,86 @@ interface VersionItem {
|
|
|
deptId: string; // 部门ID string
|
|
|
orgId: string; // 组织ID string
|
|
|
updator: string; // 上次修改人 string
|
|
|
+ publishStatus: number; //发布状态:0-发布 1-未发布
|
|
|
}
|
|
|
|
|
|
-const engineeringList = ref<VersionItem[]>([
|
|
|
- {
|
|
|
- id: "",
|
|
|
- engineeringProductName: "",
|
|
|
- engineeringType: "",
|
|
|
- engineeringVersion: "",
|
|
|
- creator: "",
|
|
|
- updated: "",
|
|
|
- created: "",
|
|
|
- deleted: "",
|
|
|
- deptId: "",
|
|
|
- orgId: "",
|
|
|
- updator: "",
|
|
|
- },
|
|
|
- {
|
|
|
- id: "",
|
|
|
- engineeringProductName: "",
|
|
|
- engineeringType: "",
|
|
|
- engineeringVersion: "",
|
|
|
- creator: "",
|
|
|
- updated: "",
|
|
|
- created: "",
|
|
|
- deleted: "",
|
|
|
- deptId: "",
|
|
|
- orgId: "",
|
|
|
- updator: "",
|
|
|
- },
|
|
|
- {
|
|
|
- id: "",
|
|
|
- engineeringProductName: "",
|
|
|
- engineeringType: "",
|
|
|
- engineeringVersion: "",
|
|
|
- creator: "",
|
|
|
- updated: "",
|
|
|
- created: "",
|
|
|
- deleted: "",
|
|
|
- deptId: "",
|
|
|
- orgId: "",
|
|
|
- updator: "",
|
|
|
- },
|
|
|
- {
|
|
|
- id: "",
|
|
|
- engineeringProductName: "",
|
|
|
- engineeringType: "",
|
|
|
- engineeringVersion: "",
|
|
|
- creator: "",
|
|
|
- updated: "",
|
|
|
- created: "",
|
|
|
- deleted: "",
|
|
|
- deptId: "",
|
|
|
- orgId: "",
|
|
|
- updator: "",
|
|
|
- },
|
|
|
-]);
|
|
|
-
|
|
|
-/**
|
|
|
- * 分页事件,每页9条
|
|
|
- */
|
|
|
-const handleChange = (currentPage: number, pageSize: number) => {
|
|
|
- // console.log(currentPage);
|
|
|
- // console.log(pageSize);
|
|
|
-};
|
|
|
-
|
|
|
/**
|
|
|
* 显示新增弹框
|
|
|
*/
|
|
|
-let showAdd = ref(false);
|
|
|
+const addRef = ref();
|
|
|
const showAddFun = () => {
|
|
|
- showAdd.value = true;
|
|
|
+ addRef.value && addRef.value.openDialog();
|
|
|
+};
|
|
|
+const toEdit = (row) => {
|
|
|
+ addRef.value &&
|
|
|
+ addRef.value.openDialog(true, JSON.parse(JSON.stringify(row)));
|
|
|
};
|
|
|
|
|
|
-/**
|
|
|
- * 新增弹框返回的数据 请求完成后关闭弹框 showAdd.value = false;
|
|
|
- */
|
|
|
-const saveFun = (item: VersionItem) => {
|
|
|
- console.log(item);
|
|
|
+// 发布
|
|
|
+const changeProjectStatus = async (item: VersionItem) => {
|
|
|
+ await updateProject(item);
|
|
|
+ getEngineeringList(false);
|
|
|
};
|
|
|
|
|
|
/**
|
|
|
* 显示新增弹框
|
|
|
*/
|
|
|
-let showDetails = ref(false);
|
|
|
-const showDetailsFun = (item: any) => {
|
|
|
- console.log(item);
|
|
|
- showDetails.value = true;
|
|
|
+const detailRef = ref();
|
|
|
+
|
|
|
+const showDetailsFun = (row: any) => {
|
|
|
+ detailRef.value &&
|
|
|
+ detailRef.value.openDialog(true, JSON.parse(JSON.stringify(row)));
|
|
|
+};
|
|
|
+
|
|
|
+// 获取列表数据
|
|
|
+const currentPage = ref(1);
|
|
|
+const pageSize = ref(9);
|
|
|
+const total = ref(0);
|
|
|
+const engineeringList = ref<VersionItem[]>([]);
|
|
|
+
|
|
|
+const handleSizeChange = (val: number) => {
|
|
|
+ pageSize.value = val;
|
|
|
+ currentPage.value = 1;
|
|
|
+ getEngineeringList();
|
|
|
+};
|
|
|
+const handleCurrentChange = (val: number) => {
|
|
|
+ currentPage.value = val;
|
|
|
+ getEngineeringList();
|
|
|
+};
|
|
|
+
|
|
|
+// const isAsc = ref();
|
|
|
+const getEngineeringList = (andGetTypes: boolean = true) => {
|
|
|
+ getProjectPage({
|
|
|
+ engineeringTypeList: [...checkedCities.value],
|
|
|
+ // orders: [
|
|
|
+ // {
|
|
|
+ // column: "",
|
|
|
+ // isAsc: true,
|
|
|
+ // },
|
|
|
+ // ],
|
|
|
+ pageNo: currentPage.value,
|
|
|
+ pageSize: pageSize.value,
|
|
|
+ // publishStatus: 0,
|
|
|
+ }).then((res) => {
|
|
|
+ console.log(res);
|
|
|
+ engineeringList.value = res.data.records;
|
|
|
+ total.value = res.data.totalCount;
|
|
|
+ });
|
|
|
+ if (andGetTypes) {
|
|
|
+ getEngineeringTypeList();
|
|
|
+ }
|
|
|
+};
|
|
|
+
|
|
|
+onMounted(() => {
|
|
|
+ getEngineeringList();
|
|
|
+});
|
|
|
+
|
|
|
+// 删除相关
|
|
|
+const onDelCancel = () => {};
|
|
|
+const deleteConfirm = async (item) => {
|
|
|
+ await deleteProject(item.id);
|
|
|
+ ElMessage.success("删除成功");
|
|
|
+ getEngineeringList();
|
|
|
};
|
|
|
</script>
|
|
|
|
|
@@ -261,7 +283,7 @@ const showDetailsFun = (item: any) => {
|
|
|
color: var(--hj-white-1);
|
|
|
display: flex;
|
|
|
height: 100px;
|
|
|
- background: var(--gray-bg-1);
|
|
|
+ background: $hj-white-1;
|
|
|
// width: 100%;
|
|
|
// overflow: hidden;
|
|
|
min-width: 0;
|
|
@@ -405,6 +427,7 @@ const showDetailsFun = (item: any) => {
|
|
|
box-shadow: 0px 2px 4px 0px rgba(0, 0, 0, 0.1);
|
|
|
border-radius: 4px 4px 4px 4px;
|
|
|
padding-top: 12px;
|
|
|
+ background-color: $hj-white-1;
|
|
|
}
|
|
|
|
|
|
.list-item-flex {
|