index.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467
  1. <template>
  2. <div class="app-container">
  3. <el-form v-if="type !== '2'" :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch"
  4. label-position="top">
  5. <el-row :gutter="20">
  6. <el-col :span="6">
  7. <el-form-item label="文件名称" prop="fileName">
  8. <el-input v-model.trim="queryParams.fileName" placeholder="请输入文件名称" clearable
  9. @keyup.enter.native="handleQuery" />
  10. </el-form-item>
  11. </el-col>
  12. <el-col :span="6">
  13. <el-form-item label="文件类别" prop="fileType">
  14. <el-select v-model="queryParams.fileType" placeholder="全部" clearable style="width: 100%;">
  15. <el-option v-for="dict in dict.type.file_type" :key="dict.value" :label="dict.label"
  16. :value="dict.value" />
  17. </el-select>
  18. </el-form-item>
  19. </el-col>
  20. <el-col :span="6"></el-col>
  21. <el-col :span="6"></el-col>
  22. </el-row>
  23. <!-- 可继续扩展其他查询表单项目,比如项目编号、负责人等 -->
  24. <el-row :gutter="20">
  25. <el-col :span="6">
  26. <el-form-item label="搜索">
  27. <el-button style="width: 100%;" type="primary" icon="el-icon-search" @click="handleQuery">搜索</el-button>
  28. </el-form-item>
  29. </el-col>
  30. <el-col :span="6">
  31. <el-form-item label="重置">
  32. <el-button style="width: 100%;" icon="el-icon-refresh" @click="resetQuery">重置</el-button>
  33. </el-form-item>
  34. </el-col>
  35. </el-row>
  36. </el-form>
  37. <el-row :gutter="10" class="mb8" v-if="type !== '2'">
  38. <el-col :span="1.5">
  39. <el-button type="primary" icon="el-icon-plus" size="small" @click="handleAdd">新增</el-button>
  40. </el-col>
  41. <el-col :span="1.5">
  42. <el-button type="success" class="editButton" icon="el-icon-edit" size="small" :disabled="single"
  43. @click="handleUpdate">修改</el-button>
  44. </el-col>
  45. <el-col :span="1.5">
  46. <el-button type="danger" icon="el-icon-delete" size="small" :disabled="multiple"
  47. @click="handleDelete">删除</el-button>
  48. </el-col>
  49. <el-col :span="1.5">
  50. <el-button type="warning" icon="el-icon-download" size="small" @click="handleExport">导出</el-button>
  51. </el-col>
  52. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  53. </el-row>
  54. <div class="border-card">
  55. <el-table height="450" class="tableWrapper" v-loading="loading" border :data="legalDueDiligenceList"
  56. @selection-change="handleSelectionChange">
  57. <el-table-column v-if="type === '1'" type="selection" width="55" align="center" />
  58. <!-- <el-table-column label="主键ID" align="center" prop="id" /> -->
  59. <el-table-column label="文件名称" width="300" align="center" prop="fileName">
  60. <template slot-scope="scope">
  61. <div :title="scope.row.fileName">
  62. {{ scope.row.fileName }}
  63. </div>
  64. </template>
  65. </el-table-column>
  66. <el-table-column label="文件类别" width="160" align="center" prop="fileType">
  67. <template slot-scope="scope">
  68. <dict-tag :options="dict.type.file_type" :value="scope.row.fileType" />
  69. </template>
  70. </el-table-column>
  71. <el-table-column label="项目名称" width="200" align="center" prop="tProjectPool.projectName">
  72. <template slot-scope="scope">
  73. <div :title="scope.row.tProjectPool.projectName">
  74. {{ scope.row.tProjectPool.projectName }}
  75. </div>
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="项目阶段" align="center" prop="projectStage">
  79. <template slot-scope="scope">
  80. <dict-tag :options="dict.type.project_stage" :value="scope.row.projectStage" />
  81. </template>
  82. </el-table-column>
  83. <el-table-column label="备注" width="120" align="center" prop="remark">
  84. <template slot-scope="scope">
  85. <div :title="scope.row.remark">
  86. {{ scope.row.remark }}
  87. </div>
  88. </template>
  89. </el-table-column>
  90. <el-table-column label="创建人" width="120" align="center" prop="createBy">
  91. <template slot-scope="scope">
  92. <div :title="scope.row.createBy">
  93. {{ scope.row.createBy }}
  94. </div>
  95. </template>
  96. </el-table-column>
  97. <el-table-column label="创建时间" width="160" align="center" prop="createTime">
  98. <template slot-scope="scope">
  99. <div :title="scope.row.createTime">
  100. {{ scope.row.createTime }}
  101. </div>
  102. </template>
  103. </el-table-column>
  104. <el-table-column width="120" label="操作" align="center" class-name="small-padding fixed-width">
  105. <template slot-scope="scope">
  106. <el-button size="small" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)">修改</el-button>
  107. <el-button class="custom-red-color" size="small" type="text" icon="el-icon-delete"
  108. @click="handleDelete(scope.row)">删除</el-button>
  109. </template>
  110. </el-table-column>
  111. </el-table>
  112. <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
  113. @pagination="getList" />
  114. </div>
  115. <!-- 添加或修改文件资料对话框 -->
  116. <el-dialog :title="title" :visible.sync="open" width="1000px" append-to-body>
  117. <el-form class="special-el-form" ref="fileForm" :model="form" :rules="rules" label-width="90px">
  118. <el-form-item label="文件名称" prop="fileName">
  119. <el-input maxlength="100" v-model="form.fileName" placeholder="请输入文件名称" />
  120. </el-form-item>
  121. <el-form-item label="文件类别" prop="fileType">
  122. <el-select v-model="form.fileType" placeholder="请选择文件类别">
  123. <el-option v-for="dict in dict.type.file_type" :key="dict.value" :label="dict.label"
  124. :value="dict.value"></el-option>
  125. </el-select>
  126. </el-form-item>
  127. <el-form-item label="项目名称" prop="projectName">
  128. <div class="el-input__inner inputSimulation yichu1" @click="handleProjectItem"
  129. :class="{ show_disabled: pageType === '1' }" :title="form.projectName">
  130. {{ form.projectName ? form.projectName : "请选择项目" }}
  131. </div>
  132. <projectItem ref="projectItem" @getProjectInfo="getProjectInfo"></projectItem>
  133. </el-form-item>
  134. <el-form-item label="项目阶段" prop="projectStage">
  135. <el-select v-model="form.projectStage" disabled placeholder="">
  136. <el-option v-for="dict in dict.type.project_stage" :key="dict.value" :label="dict.label"
  137. :value="dict.value" />
  138. </el-select>
  139. </el-form-item>
  140. <!-- <el-form-item label="会议编号" prop="fileBusinessId">
  141. <div
  142. class="el-input__inner inputSimulation"
  143. @click="handleMeetingItem"
  144. >
  145. {{ form.meetingTheme ? form.meetingTheme : "请选择会议" }}
  146. </div>
  147. <meetingItem
  148. ref="meetingItem"
  149. @getMeetingInfo="getMeetingInfo"
  150. ></meetingItem>
  151. </el-form-item> -->
  152. <el-form-item label="文件" prop="listFile" class="special-el-form-item">
  153. <fileItem ref="fileItems" :id="form.id" @getFileList="getFileList"></fileItem>
  154. </el-form-item>
  155. <el-form-item label="备注" prop="remark" class="special-el-form-item">
  156. <el-input maxlength="200" rows="4" type="textarea" v-model="form.remark" placeholder="请输入备注" />
  157. </el-form-item>
  158. </el-form>
  159. <div slot="footer" class="dialog-footer">
  160. <el-button type="primary" @click="submitForm" v-preventReClick>确 定</el-button>
  161. <el-button @click="cancel">取 消</el-button>
  162. </div>
  163. </el-dialog>
  164. </div>
  165. </template>
  166. <script>
  167. import {
  168. listLegalDueDiligence,
  169. getLegalDueDiligence,
  170. delLegalDueDiligence,
  171. addLegalDueDiligence,
  172. updateLegalDueDiligence,
  173. } from "@/api/file/legalDueDiligence";
  174. import projectItem from "../../invest/components/projectItem";
  175. import fileItem from "../../invest/components/fileItem";
  176. import meetingItem from "../../invest/components/meetingItem";
  177. export default {
  178. props: {
  179. type: {
  180. type: String,
  181. default: "1", //1=显示全部列表 2=显示某项目下的详情列表
  182. },
  183. projectId: {
  184. type: String,
  185. },
  186. },
  187. components: { projectItem, fileItem, meetingItem },
  188. dicts: ["file_type", "project_stage"],
  189. data() {
  190. const validateLogo = (rule, value, callback) => {
  191. if (this.fileList.length <= 0) {
  192. callback(new Error("请上传文件"));
  193. } else {
  194. callback();
  195. }
  196. };
  197. return {
  198. pageType: null,
  199. id: "",
  200. fileList: [],
  201. // 遮罩层
  202. loading: true,
  203. // 选中数组
  204. ids: [],
  205. idsName: [],
  206. // 非单个禁用
  207. single: true,
  208. // 非多个禁用
  209. multiple: true,
  210. // 选中数组
  211. selectRowList: [],
  212. // 显示搜索条件
  213. showSearch: true,
  214. // 总条数
  215. total: 0,
  216. // 文件资料表格数据
  217. legalDueDiligenceList: [],
  218. // 弹出层标题
  219. title: "",
  220. // 是否显示弹出层
  221. open: false,
  222. // 查询参数
  223. queryParams: {
  224. pageNum: 1,
  225. pageSize: 10,
  226. fileName: null,
  227. fileType: null,
  228. projectStage: null,
  229. fileBusinessId: null,
  230. orderByColumn: "createTime",
  231. isAsc: "desc",
  232. },
  233. // 表单参数
  234. form: {
  235. id: null,
  236. fileName: null,
  237. fileType: null,
  238. projectPoolId: null,
  239. projectName: null,
  240. projectStage: null,
  241. meetingTheme: null,
  242. fileBusinessId: null,
  243. delFlag: null,
  244. remark: null,
  245. createBy: null,
  246. createTime: null,
  247. updateBy: null,
  248. updateTime: null,
  249. listFile: null,
  250. },
  251. // 表单校验
  252. rules: {
  253. fileName: [{ required: true, trigger: "blur", message: "请输入" }],
  254. projectName: [{ required: true, trigger: "blur", message: "请选择" }],
  255. fileType: [{ required: true, trigger: "change", message: "请选择" }],
  256. listFile: [{ required: true, validator: validateLogo }],
  257. },
  258. };
  259. },
  260. created() {
  261. if (this.projectId) {
  262. this.queryParams.projectPoolId = this.projectId;
  263. }
  264. this.getList();
  265. },
  266. methods: {
  267. // 获取公司信息
  268. getProjectInfo(info) {
  269. if (info.length > 0) {
  270. this.form.projectPoolId = info[0].id;
  271. this.form.projectName = info[0].projectName;
  272. this.form.projectStage = info[0].projectStage;
  273. this.form.projectState = info[0].projectState;
  274. this.$refs.fileForm.clearValidate(["projectName"]);
  275. }
  276. },
  277. //展示人员
  278. handleProjectItem() {
  279. this.$refs.projectItem.showProjectItem = true;
  280. },
  281. // 获取会议信息
  282. // getMeetingInfo(info) {
  283. // if (info.length > 0) {
  284. // this.form.fileBusinessId = info[0].id;
  285. // this.form.meetingTheme = info[0].meetingTheme;
  286. // }
  287. // },
  288. handleMeetingItem() {
  289. this.$refs.meetingItem.showMeetingItem = true;
  290. },
  291. // 获取fileList
  292. getFileList(fileList) {
  293. this.fileList = fileList;
  294. if (fileList && fileList.length > 0) {
  295. this.$refs.fileForm.clearValidate(["listFile"]);
  296. } else {
  297. this.fileList = [];
  298. }
  299. },
  300. /** 查询文件资料列表 */
  301. getList() {
  302. this.loading = true;
  303. if (this.projectId) {
  304. this.queryParams.projectPoolId = this.projectId;
  305. }
  306. listLegalDueDiligence(this.queryParams).then((response) => {
  307. this.legalDueDiligenceList = response.rows;
  308. this.total = response.total;
  309. this.loading = false;
  310. });
  311. },
  312. // 取消按钮
  313. cancel() {
  314. this.open = false;
  315. this.reset();
  316. },
  317. // 表单重置
  318. reset() {
  319. this.form = {
  320. id: null,
  321. fileName: null,
  322. fileType: null,
  323. projectPoolId: null,
  324. projectName: null,
  325. projectStage: null,
  326. meetingTheme: null,
  327. fileBusinessId: null,
  328. delFlag: null,
  329. remark: null,
  330. createBy: null,
  331. createTime: null,
  332. updateBy: null,
  333. updateTime: null,
  334. listFile: null,
  335. };
  336. this.resetForm("form");
  337. },
  338. /** 搜索按钮操作 */
  339. handleQuery() {
  340. this.queryParams.pageNum = 1;
  341. this.getList();
  342. },
  343. /** 重置按钮操作 */
  344. resetQuery() {
  345. this.resetForm("queryForm");
  346. this.queryParams.orderByColumn = "createTime";
  347. this.queryParams.isAsc = "desc";
  348. this.handleQuery();
  349. },
  350. // 多选框选中数据
  351. handleSelectionChange(selection) {
  352. this.ids = selection.map((item) => item.id);
  353. this.idsName = selection.map((item) => item.fileName);
  354. this.single = selection.length !== 1;
  355. this.multiple = !selection.length;
  356. this.selectRowList = selection;
  357. },
  358. /** 新增按钮操作 */
  359. handleAdd(projectId) {
  360. let that = this;
  361. this.fileList = [];
  362. this.reset();
  363. if (projectId && typeof projectId === "string") {
  364. this.pageType = "1";
  365. let projectItemMessage = this.$store.getters.projectItemMessage;
  366. this.form.projectPoolId = projectItemMessage.id;
  367. this.form.projectName = projectItemMessage.projectName;
  368. this.form.projectStage = projectItemMessage.projectStage;
  369. }
  370. this.open = true;
  371. this.title = "添加文件资料";
  372. // 设置新增时的默认文件类别
  373. this.form.fileType = "p";
  374. setTimeout(() => {
  375. that.$refs.fileItems.fileList = [];
  376. }, 200);
  377. },
  378. /** 修改按钮操作 */
  379. handleUpdate(row) {
  380. let that = this;
  381. this.reset();
  382. // 1. 判断参数是否为事件对象(页面级按钮点击)
  383. if (row instanceof PointerEvent) {
  384. // 从全局选中的数据中获取 ID(假设用 selectRowList 存储选中项)
  385. row = this.selectRowList[0];
  386. }
  387. let id = row.id || this.ids;
  388. getLegalDueDiligence(id).then((response) => {
  389. this.form = response.data;
  390. this.form.projectName = response.data.tProjectPool.projectName;
  391. this.form.projectStage = response.data.tProjectPool.projectStage;
  392. this.open = true;
  393. this.title = "修改文件资料";
  394. setTimeout(() => {
  395. this.$refs.fileItems.fileList = [];
  396. if (row.fileId) {
  397. id = row.fileId;
  398. this.$refs.fileItems.getListFileById(id);
  399. } else {
  400. this.$refs.fileItems.getListFileBusinessId(id);
  401. }
  402. }, 300);
  403. });
  404. },
  405. /** 提交按钮 */
  406. submitForm() {
  407. //取消该项校验
  408. // console.log(this.fileList.length > 0);
  409. this.$refs["fileForm"].validate((valid) => {
  410. if (valid) {
  411. this.form.listFile = this.fileList;
  412. if (this.form.id != null) {
  413. updateLegalDueDiligence(this.form).then((response) => {
  414. this.$modal.msgSuccess("修改成功");
  415. this.open = false;
  416. this.getList();
  417. });
  418. } else {
  419. addLegalDueDiligence(this.form).then((response) => {
  420. this.$modal.msgSuccess("新增成功");
  421. this.open = false;
  422. this.getList();
  423. });
  424. }
  425. }
  426. });
  427. },
  428. /** 删除按钮操作 */
  429. handleDelete(row) {
  430. const ids = row.id || this.ids;
  431. const idsName = row.fileName ? row.fileName : this.idsName;
  432. this.$modal
  433. .confirm('是否确认删除"' + idsName + '"?')
  434. .then(function () {
  435. return delLegalDueDiligence(ids);
  436. })
  437. .then(() => {
  438. this.getList();
  439. this.$modal.msgSuccess("删除成功");
  440. })
  441. .catch(() => { });
  442. },
  443. /** 导出按钮操作 */
  444. handleExport() {
  445. this.download(
  446. "file/legalDueDiligence/export",
  447. {
  448. ...this.queryParams,
  449. },
  450. `legalDueDiligence_${new Date().getTime()}.xlsx`
  451. );
  452. },
  453. },
  454. };
  455. </script>