info-dialog.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. <template>
  2. <hc-dialog
  3. v-model="isShow"
  4. ui="hc-project-info-dialog-box"
  5. widths="64rem"
  6. is-table
  7. title="项目信息"
  8. :footer="false"
  9. :padding="false"
  10. @close="dialogClose"
  11. >
  12. <el-container class="hc-project-info-dialog">
  13. <el-header>
  14. <div class="left">
  15. <el-button
  16. hc-btn
  17. color="#626aef"
  18. style="color: white"
  19. @click="toCheck('measure')"
  20. >计量管理</el-button
  21. >
  22. <el-button
  23. hc-btn
  24. color="#e233fb"
  25. style="color: white"
  26. @click="toCheck('lar')"
  27. >征拆划分</el-button
  28. >
  29. <el-button
  30. hc-btn
  31. color="#ac54ff"
  32. style="color: white"
  33. @click="toCheck('test')"
  34. >试验划分</el-button
  35. >
  36. <el-button
  37. hc-btn
  38. type="success"
  39. style="color: white"
  40. @click="toCheck('wbsTree')"
  41. >WBS树管理</el-button
  42. >
  43. <el-button
  44. hc-btn
  45. color="#2bbeed"
  46. style="color: white"
  47. @click="toCheck('logTree')"
  48. >日志树管理</el-button
  49. >
  50. </div>
  51. <div class="right">
  52. <el-button
  53. hc-btn
  54. type="warning"
  55. @click="toCheck('editProject')"
  56. >编辑项目</el-button
  57. >
  58. <el-button
  59. hc-btn
  60. type="primary"
  61. @click="toCheck('addContract')"
  62. >创建合同段</el-button
  63. >
  64. <el-button v-del-com:[delProject] hc-btn type="danger"
  65. >删除项目</el-button
  66. >
  67. </div>
  68. </el-header>
  69. <el-container>
  70. <el-aside width="300px">
  71. <hc-body scrollbar padding="0px">
  72. <hc-list-item
  73. title="项目ID:"
  74. :content="projectInfo.id"
  75. />
  76. <hc-list-item
  77. title="项目简称:"
  78. :content="projectInfo.projectAlias"
  79. />
  80. <hc-list-item
  81. title="项目全名:"
  82. :content="projectInfo.projectName"
  83. />
  84. <hc-list-item
  85. title="创建时间:"
  86. :content="projectInfo.createTime"
  87. />
  88. <hc-list-item
  89. title="更新时间:"
  90. :content="projectInfo.updateTime"
  91. />
  92. </hc-body>
  93. </el-aside>
  94. <el-main>
  95. <hc-body :scrollbar="contractList.length > 0" padding="0px">
  96. <hc-empty v-if="contractList.length <= 0" />
  97. <hc-card-item
  98. v-for="item in contractList"
  99. v-else
  100. :key="item.id"
  101. class="hc-contract-list-card"
  102. >
  103. <div class="contract-type">
  104. <div
  105. v-if="item.contractType === 1"
  106. class="name bg-1"
  107. >
  108. 施工
  109. </div>
  110. <div
  111. v-if="item.contractType === 2"
  112. class="name bg-2"
  113. >
  114. 监理
  115. </div>
  116. <div
  117. v-if="item.contractType === 3"
  118. class="name bg-3"
  119. >
  120. 业主
  121. </div>
  122. </div>
  123. <div class="contract-content">
  124. <div class="name">{{ item.contractName }}</div>
  125. <div class="footer">
  126. <div class="time">
  127. {{ item.updateTime }}
  128. </div>
  129. <div class="action">
  130. <el-link
  131. type="warning"
  132. @click="
  133. toCheck('editContract', item)
  134. "
  135. >编辑合同段信息</el-link
  136. >
  137. <el-link
  138. v-if="item.contractType === 1"
  139. type="success"
  140. @click="
  141. toCheck('wbsContract', item)
  142. "
  143. >分配WBS</el-link
  144. >
  145. <el-link
  146. v-del-com:[delContract]="item"
  147. type="danger"
  148. >删除</el-link
  149. >
  150. </div>
  151. </div>
  152. </div>
  153. </hc-card-item>
  154. </hc-body>
  155. </el-main>
  156. </el-container>
  157. </el-container>
  158. </hc-dialog>
  159. </template>
  160. <script setup>
  161. import { ref, watch } from "vue";
  162. import { deepClone, getArrValue, getObjValue, isNullES } from "js-fast-way";
  163. import mainApi from "~api/project/project";
  164. import contractApi from "~api/project/contract";
  165. const props = defineProps({
  166. ids: {
  167. type: [String, Number],
  168. default: "",
  169. },
  170. });
  171. //事件
  172. const emit = defineEmits(["change", "check", "close"]);
  173. //双向绑定
  174. // eslint-disable-next-line no-undef
  175. const isShow = defineModel("modelValue", {
  176. default: false,
  177. });
  178. //监听数据
  179. const projectId = ref(props.ids);
  180. watch(
  181. () => props.ids,
  182. (id) => {
  183. projectId.value = id;
  184. },
  185. { deep: true }
  186. );
  187. //监听显示
  188. watch(isShow, (val) => {
  189. if (val) {
  190. getProjectInfo();
  191. } else {
  192. projectInfo.value = {};
  193. projectId.value = "";
  194. emit("close");
  195. }
  196. });
  197. //获取项目信息
  198. const projectInfo = ref({});
  199. const getProjectInfo = async () => {
  200. if (isNullES(projectId.value)) return;
  201. const { data } = await mainApi.detail(projectId.value);
  202. projectInfo.value = getObjValue(data);
  203. await getContractList(projectId.value);
  204. };
  205. //获取合同段信息
  206. const contractList = ref([]);
  207. const getContractList = async (id) => {
  208. if (isNullES(id)) return;
  209. const { data } = await contractApi.getList(id);
  210. contractList.value = getArrValue(data);
  211. };
  212. //关闭弹窗
  213. const dialogClose = () => {
  214. projectInfo.value = {};
  215. isShow.value = false;
  216. emit("close");
  217. };
  218. //删除项目
  219. const delProject = async (_, resolve) => {
  220. if (isNullES(projectId.value)) return;
  221. const { isRes } = await mainApi.del(projectId.value);
  222. resolve(); //关闭弹窗
  223. if (!isRes) return;
  224. window.$message.success("删除成功");
  225. dialogClose();
  226. emit("change");
  227. };
  228. //删除合同段
  229. const delContract = async ({ item }, resolve) => {
  230. const { isRes } = await contractApi.del(item.id);
  231. resolve(); //关闭弹窗
  232. if (!isRes) return;
  233. window.$message.success("删除成功");
  234. getContractList(projectId.value).then();
  235. };
  236. //功能事件回调
  237. const toCheck = (type, item = {}) => {
  238. //measure, lar, test, wbsTree, logTree, editProject, addContract, editContract, wbsContract
  239. //计量管理,征拆划分,实验划分,WBS树管理,日志树管理,编辑项目,创建合同段,编辑合同段信息,分配WBS
  240. const info = deepClone(projectInfo.value);
  241. dialogClose();
  242. emit("check", { type, info, item });
  243. };
  244. </script>
  245. <style lang="scss">
  246. .el-container.hc-project-info-dialog {
  247. position: relative;
  248. height: 100%;
  249. .el-header {
  250. position: relative;
  251. display: flex;
  252. align-items: center;
  253. justify-content: space-between;
  254. --el-header-padding: 0;
  255. --el-header-height: 50px;
  256. border-bottom: 1px solid #f4f4f4;
  257. }
  258. .el-aside,
  259. .el-main {
  260. position: relative;
  261. --el-main-padding: 0;
  262. .hc-new-main-body {
  263. top: 10px;
  264. }
  265. }
  266. .el-aside {
  267. border-right: 1px solid #f4f4f4;
  268. .hc-new-main-body {
  269. right: 10px;
  270. }
  271. }
  272. .el-main .hc-new-main-body {
  273. left: 10px;
  274. }
  275. .hc-list-item .title {
  276. width: 70px;
  277. }
  278. .hc-list-item .content {
  279. flex: 1;
  280. }
  281. .hc-contract-list-card {
  282. border-radius: 4px;
  283. margin-bottom: 14px;
  284. cursor: pointer;
  285. padding: 8px 14px;
  286. background: #f3f3f3 !important;
  287. transition: all 0.3s;
  288. .hc-card-item-body {
  289. display: flex;
  290. align-items: center;
  291. }
  292. .contract-type {
  293. position: relative;
  294. margin-right: 14px;
  295. .name {
  296. position: relative;
  297. height: 43px;
  298. width: 43px;
  299. border-radius: 50px;
  300. display: flex;
  301. justify-content: center;
  302. align-items: center;
  303. color: white;
  304. }
  305. .name.bg-1 {
  306. background-color: #2a9b79;
  307. }
  308. .name.bg-2 {
  309. background-color: #9b6c2a;
  310. }
  311. .name.bg-3 {
  312. background-color: #2a359b;
  313. }
  314. }
  315. .contract-content {
  316. position: relative;
  317. flex: 1;
  318. .name {
  319. color: #101010;
  320. font-weight: bold;
  321. }
  322. .footer {
  323. margin-top: 10px;
  324. position: relative;
  325. display: flex;
  326. align-items: center;
  327. justify-content: space-between;
  328. .time {
  329. color: #747474;
  330. font-size: 14px;
  331. }
  332. .el-link + .el-link {
  333. margin-left: 10px;
  334. }
  335. }
  336. }
  337. &:hover {
  338. box-shadow: 2px 2px var(--el-color-primary-light-7);
  339. }
  340. }
  341. }
  342. .el-overlay-dialog .el-dialog.hc-new-dialog.hc-project-info-dialog-box {
  343. height: 500px;
  344. max-height: 500px;
  345. --el-dialog-margin-top: 15vh;
  346. }
  347. </style>