Newer
Older
KaiFengPC / src / views / document / projectAudit / index.vue
@鲁yixuan 鲁yixuan on 29 Aug 28 KB updata
  1. <template>
  2. <!-- 项目审批、计划管理 -->
  3. <div class="publicContainer">
  4. <el-form :model="queryParams" ref="queryRef" :inline="true" v-show="showSearch">
  5. <el-form-item label="项目名称:" prop="projectName">
  6. <el-input
  7. v-model="queryParams.projectName"
  8. placeholder="请输入项目名称"
  9. clearable
  10. @keyup.enter="handleQuery"
  11. style="width: 240px"
  12. />
  13. </el-form-item>
  14. <el-form-item label="计划时间" prop="timer">
  15. <el-date-picker
  16. style="width: 240px"
  17. format="YYYY-MM-DD"
  18. value-format="YYYY-MM-DD"
  19. v-model="queryParams.timer"
  20. type="daterange"
  21. unlink-panels
  22. range-separator="至"
  23. start-placeholder="开始时间"
  24. end-placeholder="结束时间"
  25. />
  26. </el-form-item>
  27. <el-form-item>
  28. <el-button type="primary" icon="Search" @click="handleQuery">搜索</el-button>
  29. <el-button icon="Refresh" @click="resetQuery">重置</el-button>
  30. </el-form-item>
  31. </el-form>
  32. <!-- 操作栏 -->
  33. <el-row :gutter="10" class="mb8">
  34. <el-col :span="1.5">
  35. <el-button type="primary" plain icon="Plus" @click="handleAdd" v-hasPermi="['system:post:add']">新增</el-button>
  36. </el-col>
  37. <right-toolbar v-model:showSearch="showSearch" @queryTable="getList"></right-toolbar>
  38. </el-row>
  39. <!-- 表格 -->
  40. <el-table v-loading="loading" :data="postList" @selection-change="handleSelectionChange" max-height="500">
  41. <el-table-column label="序号" type="index" width="60" />
  42. <el-table-column :label="i.label" :prop="i.props" show-overflow-tooltip v-for="i in projectPlanCloum">
  43. <template #default="{ row }" v-if="i.props == 'startTime'">
  44. {{ row.startTime.substring(0, 10) }}
  45. </template>
  46. <template #default="{ row }" v-if="i.props == 'endTime'">
  47. {{ row.endTime.substring(0, 10) }}
  48. </template>
  49. </el-table-column>
  50. <el-table-column label="操作" width="250" class-name="small-padding fixed-width">
  51. <template #default="scope">
  52. <el-button link type="primary" icon="View" @click="handleUpdate(scope.row, 1)">详情</el-button>
  53. <el-button link type="warning" icon="Edit" @click="handleUpdate(scope.row, 2)" v-hasPermi="['system:post:edit']">修改</el-button>
  54. <el-button link type="danger" icon="Delete" @click="handleDelete(scope.row)" v-hasPermi="['system:post:remove']">删除</el-button>
  55. </template>
  56. </el-table-column>
  57. </el-table>
  58. <!-- 分页 -->
  59. <pagination
  60. v-show="total > 0"
  61. :total="total"
  62. v-model:page="queryParams.pageNum"
  63. v-model:limit="queryParams.pageSize"
  64. @pagination="getList"
  65. />
  66. <!-- 添加或修改项目计划信息对话框 -->
  67. <el-dialog :title="title" v-model="open" width="1390px">
  68. <el-form ref="postRef" :model="form" label-width="120px" :inline="true" :disabled="isShow == 1" :rules="projectPlanRules">
  69. <div class="biaoti">基本信息</div>
  70. <el-form-item label="项目名称:" style="width: 45%" prop="projectNo">
  71. <el-select
  72. :disabled="isShow == 2"
  73. v-model="form.projectNo"
  74. placeholder="请选择项目"
  75. clearable
  76. style="width: 100%"
  77. @change="TouBiaoInfo(ProjectListData, 'add')"
  78. >
  79. <el-option v-for="(dict, index) in ProjectListData" :key="dict.projectNo" :label="dict.projectName" :value="dict.projectNo" />
  80. </el-select>
  81. </el-form-item>
  82. <el-form-item label="项目编号:" style="width: 45%" prop="projectNo">
  83. <el-input disabled v-model="form.projectNo" placeholder="请先选择项目" />
  84. </el-form-item>
  85. <el-form-item label="项目开始日期:" style="width: 45%" prop="startTime">
  86. <el-date-picker
  87. style="width: 100%"
  88. disabled
  89. v-model="form.startTime"
  90. type="date"
  91. placeholder="请选择项目开始日期"
  92. format="YYYY-MM-DD"
  93. value-format="YYYY-MM-DD"
  94. />
  95. </el-form-item>
  96. <el-form-item label="项目交付日期:" style="width: 45%" prop="endTime">
  97. <el-date-picker
  98. style="width: 100%"
  99. disabled
  100. v-model="form.endTime"
  101. type="date"
  102. placeholder="请选择项目交付日期"
  103. format="YYYY-MM-DD"
  104. value-format="YYYY-MM-DD"
  105. />
  106. </el-form-item>
  107. <el-form-item label="项目填报日期:" style="width: 45%" prop="projectFillTime">
  108. <el-date-picker
  109. style="width: 100%"
  110. v-model="form.projectFillTime"
  111. type="date"
  112. placeholder="请选择项目填报日期"
  113. format="YYYY-MM-DD"
  114. value-format="YYYY-MM-DD"
  115. />
  116. </el-form-item>
  117. <el-form-item label="项目责任人:" style="width: 45%" prop="chargeUser">
  118. <el-input v-model="form.chargeUser" placeholder="请输入项目责任人" disabled />
  119. </el-form-item>
  120. <el-form-item label="备注:" prop="remark" style="width: 92.5%">
  121. <el-input v-model="form.remark" :autosize="{ minRows: 5, maxRows: 7 }" type="textarea" placeholder="请输入备注" />
  122. </el-form-item>
  123. <el-form-item label="附件:" style="width: 93%">
  124. <ImageFileUpload
  125. :limit="3"
  126. :saveFileArr="fileList1"
  127. :listType="'text'"
  128. :fileType="['csv', 'xls', 'xlsx']"
  129. :refField="'coverPhotos'"
  130. :refType="'proProjectPlanInfo'"
  131. ></ImageFileUpload>
  132. </el-form-item>
  133. <el-divider content-position="left">进度汇报明细</el-divider>
  134. <!-- <div style="text-align: right;" v-show="isAddProjetc"> -->
  135. <div style="text-align: right">
  136. <el-button type="primary" @click="onCheck({}, 1, '新增项目节点')">新增项目节点</el-button>
  137. </div>
  138. <el-table :data="tableData" style="width: 100%" row-key="id" default-expand-all :tree-prop="{ children: 'children' }">
  139. <el-table-column prop="nodeName" label="一级节点" width="180" />
  140. <el-table-column prop="planStartTime" label="计划日期起" />
  141. <el-table-column prop="planEndTime" label="计划日期止" />
  142. <el-table-column prop="estimatedWorkHours" label="预算工时" />
  143. <el-table-column prop="dutyUserId" label="负责人">
  144. <template #default="{ row }">
  145. <span>{{ getStateName(row.dutyUserId) }}</span>
  146. </template>
  147. </el-table-column>
  148. <el-table-column prop="outputData" label="输出资料" />
  149. <el-table-column prop="remark" label="备注" />
  150. <el-table-column label="操作" class-name="nodename" fixde="right" width="250">
  151. <template #default="{ row }">
  152. <el-button
  153. v-show="row.tier == 1 || row.tier == 2"
  154. link
  155. type="success"
  156. @click="onCheck(row, 1, `新增${row.tier == 1 ? '二级节点' : '三级节点'}`)"
  157. >新增{{ row.tier == 1 ? '二级' : '三级' }}节点</el-button
  158. >
  159. <el-button
  160. link
  161. type="primary"
  162. @click="onCheck(row, 2, `编辑${row.tier == 1 ? '一级节点' : row.tier == 2 ? '二级节点' : '三级节点'}`)"
  163. >编辑</el-button
  164. >
  165. <el-button link type="danger" @click="onCheck(row, 3)">删除</el-button>
  166. </template>
  167. </el-table-column>
  168. </el-table>
  169. </el-form>
  170. <template #footer>
  171. <div class="dialog-footer">
  172. <el-button v-if="isShow != 1" type="primary" @click="submitForm">确定</el-button>
  173. <el-button @click="cancel">关闭</el-button>
  174. </div>
  175. </template>
  176. </el-dialog>
  177. <el-dialog :title="editDalgotitle" v-model="editDalgo" width="800px">
  178. <el-form label-width="auto" ref="ruleFormAdd1" :model="FormList" v-if="editDalgo">
  179. <el-form-item
  180. label="一级节点:"
  181. prop="nodeName"
  182. v-if="!appryList.tier"
  183. :rules="[{ required: true, message: '节点不能为空', trigger: 'blur' }]"
  184. >
  185. <el-input v-model="FormList.nodeName" placeholder="请输入一级节点" />
  186. </el-form-item>
  187. <el-form-item
  188. label="二级节点:"
  189. prop="nodeName2"
  190. v-if="appryList.tier == 1"
  191. :rules="[{ required: true, message: '节点不能为空', trigger: 'blur' }]"
  192. >
  193. <el-input v-model="FormList.nodeName2" placeholder="请输入二级节点" />
  194. </el-form-item>
  195. <el-form-item
  196. label="三级节点:"
  197. prop="nodeName3"
  198. v-if="appryList.tier == 2"
  199. :rules="[{ required: true, message: '节点不能为空', trigger: 'blur' }]"
  200. >
  201. <el-input v-model="FormList.nodeName3" placeholder="请输入三级节点" />
  202. </el-form-item>
  203. <el-form-item
  204. label="关键里程碑:"
  205. prop="keyMilestone"
  206. :rules="[
  207. {
  208. required: true,
  209. message: '关键里程碑不能为空',
  210. trigger: 'change',
  211. },
  212. ]"
  213. >
  214. <el-radio-group v-model="FormList.keyMilestone" class="ml-4" :disabled="appryList.tier">
  215. <el-radio :label="1" size="large"></el-radio>
  216. <el-radio :label="0" size="large"></el-radio>
  217. </el-radio-group>
  218. </el-form-item>
  219. <el-form-item
  220. label="计划开始日期:"
  221. prop="planStartTime"
  222. :rules="[
  223. {
  224. required: true,
  225. message: '计划开始日期不能为空',
  226. trigger: 'change',
  227. },
  228. ]"
  229. >
  230. <el-date-picker
  231. style="width: 100%"
  232. clearable
  233. format="YYYY-MM-DD"
  234. value-format="YYYY-MM-DD"
  235. v-model="FormList.planStartTime"
  236. type="date"
  237. range-separator="到"
  238. placeholder="请选择计划开始日期"
  239. :disabled-date="disabledDate"
  240. />
  241. </el-form-item>
  242. <el-form-item
  243. label="计划结束日期:"
  244. prop="planEndTime"
  245. :rules="[
  246. {
  247. required: true,
  248. message: '计划结束日期不能为空',
  249. trigger: 'change',
  250. },
  251. ]"
  252. >
  253. <el-date-picker
  254. clearable
  255. style="width: 100%"
  256. format="YYYY-MM-DD"
  257. value-format="YYYY-MM-DD"
  258. v-model="FormList.planEndTime"
  259. type="date"
  260. range-separator="到"
  261. placeholder="请选择计划结束日期"
  262. :disabled-date="disabledDate"
  263. />
  264. </el-form-item>
  265. <el-form-item label="负责人:" prop="dutyUserId" :rules="[{ required: true, message: '负责人不能为空', trigger: 'change' }]">
  266. <el-select clearable v-model="FormList.dutyUserId" class="m-2" placeholder="请选择负责人" size="mini" style="width: 100%">
  267. <el-option v-for="item in personList" :key="item.userId" :label="item.nickName" :value="item.userId + ''" />
  268. </el-select>
  269. </el-form-item>
  270. <el-form-item label="输出资料:" prop="outputData">
  271. <el-input v-model="FormList.outputData" placeholder="请输入输出资料" />
  272. </el-form-item>
  273. <el-form-item label="预算工时:" prop="estimatedWorkHours">
  274. <el-input style="width: 100%" v-model="FormList.estimatedWorkHours" type="number" placeholder="请输入预算工时" />
  275. </el-form-item>
  276. <el-form-item label="备注:" prop="remark">
  277. <el-input style="width: 100%" v-model="FormList.remark" type="textarea" placeholder="请输入备注" />
  278. </el-form-item>
  279. <el-form-item label="排序号:" prop="sort">
  280. <el-input style="width: 100%" v-model="FormList.sort" type="number" placeholder="请输入排序号" />
  281. </el-form-item>
  282. </el-form>
  283. <div style="text-align: right; margin-right: 20px">
  284. <el-button type="primary" @click="editClick('ruleFormAdd1')">确定</el-button>
  285. <el-button @click="editDalgoClosed">关闭</el-button>
  286. </div>
  287. </el-dialog>
  288. <!-- 编辑 -->
  289. <el-dialog :title="editDalgotitle" v-model="editDalgo2" width="800px">
  290. <el-form label-width="auto" ref="ruleFormAdd2" :model="FormList" v-if="editDalgo2">
  291. <el-form-item
  292. label="一级节点:"
  293. prop="nodeName"
  294. v-if="appryList.tier == 1"
  295. :rules="[{ required: true, message: '节点不能为空', trigger: 'change' }]"
  296. >
  297. <el-input v-model="FormList.nodeName" placeholder="请输入一级节点" />
  298. </el-form-item>
  299. <el-form-item
  300. label="二级节点:"
  301. prop="nodeName"
  302. v-if="appryList.tier == 2"
  303. :rules="[{ required: true, message: '节点不能为空', trigger: 'change' }]"
  304. >
  305. <el-input v-model="FormList.nodeName" placeholder="请输入二级节点" />
  306. </el-form-item>
  307. <el-form-item
  308. label="三级节点:"
  309. prop="nodeName"
  310. v-if="appryList.tier == 3"
  311. :rules="[{ required: true, message: '节点不能为空', trigger: 'change' }]"
  312. >
  313. <el-input v-model="FormList.nodeName" placeholder="请输入三级节点" />
  314. </el-form-item>
  315. <el-form-item
  316. label="关键里程碑:"
  317. prop="keyMilestone"
  318. :rules="[
  319. {
  320. required: true,
  321. message: '关键里程碑不能为空',
  322. trigger: 'change',
  323. },
  324. ]"
  325. >
  326. <el-radio-group v-model="FormList.keyMilestone" class="ml-4" :disabled="[2, 3].includes(appryList.tier)">
  327. <el-radio :label="1" size="large"></el-radio>
  328. <el-radio :label="0" size="large"></el-radio>
  329. </el-radio-group>
  330. </el-form-item>
  331. <el-form-item
  332. label="计划开始日期:"
  333. prop="planStartTime"
  334. :rules="[
  335. {
  336. required: true,
  337. message: '计划开始日期不能为空',
  338. trigger: 'change',
  339. },
  340. ]"
  341. >
  342. <el-date-picker
  343. clearable
  344. format="YYYY-MM-DD"
  345. value-format="YYYY-MM-DD"
  346. v-model="FormList.planStartTime"
  347. type="date"
  348. range-separator="到"
  349. placeholder="请选择计划开始日期"
  350. :disabled-date="disabledDate"
  351. />
  352. </el-form-item>
  353. <el-form-item
  354. label="计划结束日期:"
  355. prop="planEndTime"
  356. :rules="[
  357. {
  358. required: true,
  359. message: '计划结束日期能为空',
  360. trigger: 'change',
  361. },
  362. ]"
  363. >
  364. <el-date-picker
  365. clearable
  366. format="YYYY-MM-DD"
  367. value-format="YYYY-MM-DD"
  368. v-model="FormList.planEndTime"
  369. type="date"
  370. range-separator="到"
  371. placeholder="请选择计划结束日期"
  372. :disabled-date="disabledDate"
  373. />
  374. </el-form-item>
  375. <el-form-item label="负责人:" prop="dutyUserId" :rules="[{ required: true, message: '负责人不能为空', trigger: 'change' }]">
  376. <el-select clearable v-model="FormList.dutyUserId" class="m-2" placeholder="请选择负责人" size="mini" style="width: 100%">
  377. <el-option v-for="item in personList" :key="item.userId" :label="item.nickName" :value="item.userId + ''" />
  378. </el-select>
  379. </el-form-item>
  380. <el-form-item label="输出资料:" prop="outputData">
  381. <el-input v-model="FormList.outputData" placeholder="请输入输出资料" />
  382. </el-form-item>
  383. <el-form-item label="预算工时:" prop="estimatedWorkHours">
  384. <el-input style="width: 100%" v-model="FormList.estimatedWorkHours" type="number" placeholder="请输入预算工时" />
  385. </el-form-item>
  386. <el-form-item label="备注:" prop="remark">
  387. <el-input style="width: 100%" v-model="FormList.remark" type="textarea" placeholder="请输入备注" />
  388. </el-form-item>
  389. <el-form-item label="排序号:" prop="sort">
  390. <el-input style="width: 100%" v-model="FormList.sort" type="number" placeholder="请输入排序号" />
  391. </el-form-item>
  392. </el-form>
  393. <div style="text-align: right">
  394. <el-button type="primary" @click="editClick('ruleFormAdd2')">确定</el-button>
  395. <el-button @click="editDalgoClosed">关闭</el-button>
  396. </div>
  397. </el-dialog>
  398. </div>
  399. </template>
  400.  
  401. <script setup name="Post">
  402. import {
  403. projectPlanInfoPage,
  404. projectPlanInfoAdd,
  405. projectPlanInfoIDS,
  406. projectPlanInfoID,
  407. projectPlanInfoEdit,
  408. projectInfoList,
  409. FileSystemList,
  410. projectInfoSelectByProjectNo,
  411. projectPlanTemplateList,
  412. getNodeCodeToUuid,
  413. } from '@/api/project/tenderReview';
  414. import { userList } from '@/api/project/noticeReward';
  415. import { getToken } from '@/utils/auth';
  416. import { ElMessage, ElMessageBox } from 'element-plus';
  417. import emgBox from '@/utils/ElMessageBox';
  418. import { projectPlanRules } from '@/utils/rules';
  419. import { projectPlanCloum } from '@/utils/cloums';
  420. import ImageFileUpload from '@/components/ImageFileUpload/index.vue'; //图片文件上传
  421.  
  422. const { proxy } = getCurrentInstance();
  423. const postList = ref([]);
  424. const open = ref(false);
  425. const loading = ref(true);
  426. const showSearch = ref(true);
  427. const ids = ref([]);
  428. const single = ref(true);
  429. const multiple = ref(true);
  430. const total = ref(0);
  431. const title = ref('');
  432. const editDalgotitle = ref('');
  433. const editDalgo = ref(false);
  434. const isAddProjetc = ref(false);
  435. const FormList = ref({ keyMilestone: 0 });
  436. const personList = ref([]);
  437. const ProjectListData = ref([]);
  438. const uploadHeader = ref({
  439. Authorization: 'Bearer ' + getToken(),
  440. });
  441. const isShow = ref();
  442. const data = reactive({
  443. form: {},
  444. queryParams: {
  445. pageNum: 1,
  446. pageSize: 10,
  447. projectName: undefined,
  448. timer: '',
  449. startTime: '',
  450. endTime: '',
  451. },
  452. rules: {
  453. projectName: [{ required: true, message: '项目计划信息编码不能为空', trigger: 'blur' }],
  454. },
  455. });
  456. const tableData = ref([]);
  457. const disabledDate = time => {
  458. let curInfo = null;
  459. if (editDalgo.value) {
  460. curInfo = appryList.value;
  461. } else if (editDalgo2.value) {
  462. const nodeCode = appryList.value.nodeCode;
  463. curInfo = getParentNode(tableData.value, nodeCode) || null;
  464. }
  465. if (!curInfo?.planStartTime || !curInfo?.planEndTime) return false;
  466. let disabled = false;
  467. if (time.getTime() < Date.parse(curInfo.planStartTime + ' 00:00:00') || time.getTime() > Date.parse(curInfo.planEndTime + ' 23:59:59')) {
  468. disabled = true;
  469. }
  470. return disabled;
  471. };
  472. const getParentNode = (list, nodeCode) => {
  473. // 遍历树节点
  474. for (let node of list) {
  475. // 如果当前节点就是目标节点的父节点,直接返回当前节点id
  476. if (node.children && node.children.some(child => child.nodeCode === nodeCode)) {
  477. return node;
  478. }
  479. // 否则继续遍历当前节点的子节点
  480. if (node.children) {
  481. const parentNode = getParentNode(node.children, nodeCode);
  482. if (parentNode !== null) {
  483. return parentNode;
  484. }
  485. }
  486. }
  487. // 如果没有找到父节点,则返回null
  488. return null;
  489. };
  490. const getStateName = r => {
  491. let a = '';
  492. personList.value.map(i => {
  493. if (i.userId == r) {
  494. a = i;
  495. }
  496. });
  497. return a.nickName;
  498. };
  499. const { queryParams, form, rules } = toRefs(data);
  500. /** 文件上传 */
  501. const fileList1 = ref([]);
  502. function handlePreview(file) {
  503. console.log(file);
  504. return ElMessageBox.confirm(`下载此文件: ${file.name}?`).then(
  505. () => window.open(file.url),
  506. () => false
  507. );
  508. }
  509. function beforeRemove(file) {
  510. return true;
  511. }
  512. /** 搜索项目计划信息列表 */
  513. function getList() {
  514. loading.value = true;
  515. if (queryParams.value.timer) {
  516. queryParams.value.planStartTime = queryParams.value.timer[0];
  517. queryParams.value.planEndTime = queryParams.value.timer[1];
  518. } else {
  519. queryParams.value.planStartTime = '';
  520. queryParams.value.planEndTime = '';
  521. }
  522. if (queryParams.value.timer2) {
  523. queryParams.value.actualFinishStartTime = queryParams.value.timer2[0];
  524. queryParams.value.actualFinishEndTime = queryParams.value.timer2[1];
  525. } else {
  526. queryParams.value.actualFinishStartTime = '';
  527. queryParams.value.actualFinishEndTime = '';
  528. }
  529. projectPlanInfoPage(queryParams.value).then(response => {
  530. postList.value = response.data;
  531. total.value = response.total;
  532. loading.value = false;
  533. });
  534. }
  535. /** 取消按钮 */
  536. function cancel() {
  537. open.value = false;
  538. reset();
  539. }
  540. /** 表单重置 */
  541. function reset() {
  542. form.value = {
  543. id: undefined,
  544. projectNo: undefined,
  545. startTime: undefined,
  546. endTime: undefined,
  547. projectFillTime: undefined,
  548. chargeUser: undefined,
  549. remark: undefined,
  550. };
  551. proxy.resetForm('postRef');
  552. }
  553. /** 搜索按钮操作 */
  554. function handleQuery() {
  555. if (queryParams.value.timer) {
  556. queryParams.value.startTime = queryParams.value.timer[0];
  557. queryParams.value.endTime = queryParams.value.timer[1];
  558. } else {
  559. queryParams.value.startTime = '';
  560. queryParams.value.endTime = '';
  561. }
  562. queryParams.value.pageNum = 1;
  563. getList();
  564. }
  565. /** 重置按钮操作 */
  566. function resetQuery() {
  567. proxy.resetForm('queryRef');
  568. queryParams.value.timer = [];
  569. queryParams.value.timer2 = [];
  570. handleQuery();
  571. }
  572. /** 多选框选中数据 */
  573. function handleSelectionChange(selection) {
  574. ids.value = selection.map(item => item.id);
  575. single.value = selection.length != 1;
  576. multiple.value = !selection.length;
  577. }
  578. /** 新增按钮操作 */
  579. function handleAdd(t) {
  580. isShow.value = t;
  581. reset();
  582. open.value = true;
  583. title.value = '项目计划信息新增';
  584. tableData.value = [];
  585. fileList1.value = [];
  586. nextTick(() => {
  587. proxy.$refs['postRef'].resetFields();
  588. });
  589. }
  590. /** 修改按钮操作 */
  591. function handleUpdate(row, t) {
  592. isShow.value = t;
  593. reset();
  594. const id = row.id || ids.value;
  595. projectPlanInfoID(id).then(response => {
  596. let d1 = response.data;
  597. open.value = true;
  598. title.value = '项目计划信息修改';
  599. let time = response.data.projectFillTime;
  600. tableData.value = response.data.projectPlanInventoryList;
  601. projectInfoSelectByProjectNo(row.projectNo).then(response => {
  602. form.value = { ...response.data, ...d1 };
  603. form.value.id = id;
  604. form.value.projectFillTime = time;
  605. console.log('response.data ', response.data);
  606. });
  607. });
  608. // 获取文件列表
  609. FileSystemList({
  610. refId: id,
  611. refType: 'proProjectPlanInfo',
  612. }).then(({ data }) => {
  613. fileList1.value = data;
  614. });
  615. }
  616. /** 提交按钮 */
  617. function submitForm() {
  618. console.log();
  619. proxy.$refs['postRef'].validate(valid => {
  620. if (valid) {
  621. form.value.projectPlanInventorySaveRequestList = tableData.value;
  622. form.value.fileSaveRequestList = [];
  623. fileList1.value.forEach(element => {
  624. // 基本信息
  625. if (element.hasOwnProperty('response')) {
  626. element.response.data.refType = 'proProjectPlanInfo';
  627. form.value.fileSaveRequestList.push(element.response.data);
  628. } else {
  629. form.value.fileSaveRequestList.push(element);
  630. }
  631. });
  632. if (form.value.id) {
  633. projectPlanInfoEdit(form.value).then(({ code }) => {
  634. if (code == 200) {
  635. proxy.$modal.msgSuccess('修改成功');
  636. open.value = false;
  637. getList();
  638. }
  639. });
  640. } else {
  641. projectPlanInfoAdd(form.value).then(({ code }) => {
  642. if (code == 200) {
  643. proxy.$modal.msgSuccess('新增成功');
  644. open.value = false;
  645. getList();
  646. }
  647. });
  648. }
  649. }
  650. });
  651. }
  652. /** 删除按钮操作 */
  653. function handleDelete(row) {
  654. const ids = row.id || ids.value;
  655. proxy.$modal
  656. .confirm('是否确认删除该数据项?')
  657. .then(function () {
  658. return projectPlanInfoIDS(ids);
  659. })
  660. .then(() => {
  661. getList();
  662. proxy.$modal.msgSuccess('删除成功');
  663. })
  664. .catch(() => {});
  665. }
  666. /** 导出按钮操作 */
  667. function handleExport() {
  668. proxy.download(
  669. 'system/post/export',
  670. {
  671. ...queryParams.value,
  672. },
  673. `post_${new Date().getTime()}.xlsx`
  674. );
  675. }
  676. /**获取所有的项目数据 */
  677. function loadProjerctListData() {
  678. projectInfoList().then(response => {
  679. ProjectListData.value = response.data;
  680. });
  681. }
  682. /**项目下拉框选择 */
  683. let al = ref();
  684. function TouBiaoInfo(val, type) {
  685. al.value = val;
  686. projectInfoSelectByProjectNoM(val, type);
  687. }
  688. function projectInfoSelectByProjectNoM(val, type) {
  689. let arra = val.filter(k => {
  690. return k.projectNo == form.value.projectNo;
  691. });
  692. let pid = arra[0].projectTypeId;
  693. FormList.value.projectTypeId = pid;
  694. projectInfoSelectByProjectNo(arra[0].projectNo).then(response => {
  695. form.value.startTime = response.data.startTime;
  696. form.value.endTime = response.data.endTime;
  697. form.value.chargeUser = response.data.chargeUser;
  698. // let params = { projectTypeId: pid };
  699. projectPlanTemplateList(pid).then(({ data }) => {
  700. tableData.value = data;
  701. isAddProjetc.value = true;
  702. });
  703. });
  704. }
  705. //删除 编辑 新增
  706. let isAdit = ref();
  707. // let
  708. let appryList = ref({});
  709. const editDalgo2 = ref(false);
  710. function onCheck(t, y, tittle) {
  711. console.log(t, 'rowrow');
  712.  
  713. editDalgotitle.value = tittle;
  714. appryList.value = t;
  715. isAdit.value = y;
  716. if (y == 3) {
  717. if (t?.children?.length > 0) {
  718. emgBox(t, projectPlanDeleteM, '该节点下有子节点您确定删除吗?');
  719. } else {
  720. projectPlanDeleteM(t);
  721. }
  722. } else if (y == 2) {
  723. editDalgo2.value = true;
  724. FormList.value = t;
  725. } else {
  726. editDalgo.value = true;
  727. FormList.value = { keyMilestone: 0 };
  728. nextTick(() => {
  729. proxy.$refs.ruleFormAdd1.resetFields();
  730. });
  731. }
  732. }
  733.  
  734. function deleteData(data, nodeCode) {
  735. let newData = data.filter(x => x.nodeCode !== nodeCode);
  736. newData.forEach(x => x.children && (x.children = deleteData(x.children, nodeCode)));
  737. return newData;
  738. }
  739.  
  740. const projectPlanDeleteM = ({ nodeCode }) => {
  741. tableData.value = deleteData(tableData.value, nodeCode);
  742. };
  743. function editDalgoClosed() {
  744. editDalgo.value = false;
  745. editDalgo2.value = false;
  746. }
  747. //新增确定 编辑确定
  748. function editClick(t) {
  749. proxy.$refs[t].validate(valid => {
  750. if (valid) {
  751. if (isAdit.value == 2) {
  752. if (!appryList.value.children) {
  753. appryList.value.children = [];
  754. } else {
  755. let arrar = appryList.value.children;
  756. }
  757. appryList.value = FormList.value;
  758. } else {
  759. getNodeCodeToUuid().then(({ data }) => {
  760. FormList.value.nodeCode = data;
  761. if (!appryList.value.children) {
  762. appryList.value.children = [];
  763. }
  764. if (appryList.value.tier == 1) {
  765. FormList.value.nodeName = FormList.value.nodeName2;
  766. FormList.value.tier = 2;
  767. FormList.value.parentNodeCode = appryList.value.nodeCode;
  768. appryList.value.children.push(FormList.value);
  769. FormList.value = { keyMilestone: 0 };
  770. }
  771. if (appryList.value.tier == 2) {
  772. FormList.value.nodeName = FormList.value.nodeName3;
  773. FormList.value.projectTypeId = appryList.value.projectTypeId;
  774. FormList.value.parentNodeCode = appryList.value.nodeCode;
  775. FormList.value.tier = 3;
  776. appryList.value.children.push(FormList.value);
  777. FormList.value = { keyMilestone: 0 };
  778. }
  779. if (!appryList.value.tier) {
  780. appryList.value.nodeCode = data;
  781. appryList.value.parentNodeCode = 0;
  782. FormList.value.tier = 1;
  783. console.log(FormList.value, 999);
  784. tableData.value.push(FormList.value);
  785. FormList.value = { keyMilestone: 0 };
  786. }
  787. });
  788. }
  789. editDalgo.value = false;
  790. editDalgo2.value = false;
  791. }
  792. });
  793. }
  794. const userListM = async () => {
  795. let { data } = await userList();
  796. personList.value = data;
  797. };
  798. getList();
  799. loadProjerctListData();
  800. userListM();
  801. </script>
  802. <style scoped lang="scss">
  803. .biaoti {
  804. font-weight: 900;
  805. font-size: 18px;
  806. margin: 20px 0;
  807. }
  808.  
  809. td.twoChildren_td,
  810. td.twoChildren_td1 {
  811. text-align: center;
  812. min-width: 130px;
  813. }
  814.  
  815. td.twoChildren_td1 {
  816. min-width: 170px;
  817. text-align: left;
  818. }
  819.  
  820. td.border_td {
  821. border-bottom: 1.5px solid #ddd;
  822. }
  823.  
  824. .flex {
  825. display: flex;
  826. justify-content: center;
  827. align-items: center;
  828. flex-direction: column;
  829. }
  830.  
  831. :deep(.nodename.el-table__cell > .cell) {
  832. padding: 0;
  833. width: 100%;
  834. text-align: center;
  835. }
  836. </style>