index.vue 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="采购编号" prop="number">
  5. <el-input
  6. v-model="queryParams.number"
  7. placeholder="请输入采购编号"
  8. clearable
  9. @keyup.enter.native="handleQuery"
  10. />
  11. </el-form-item>
  12. <el-form-item label="申请组织" prop="apply">
  13. <el-input
  14. v-model="queryParams.apply"
  15. placeholder="请输入申请组织"
  16. clearable
  17. @keyup.enter.native="handleQuery"
  18. />
  19. </el-form-item>
  20. <el-form-item label="申请时间" prop="currency">
  21. <el-date-picker clearable
  22. v-model="queryParams.currency"
  23. type="date"
  24. style="width: 205px;"
  25. value-format="yyyy-MM-dd"
  26. placeholder="请选择申请时间">
  27. </el-date-picker>
  28. </el-form-item>
  29. <el-form-item label="申请部门" prop="department">
  30. <el-input
  31. v-model="queryParams.department"
  32. placeholder="请输入申请部门"
  33. clearable
  34. @keyup.enter.native="handleQuery"
  35. />
  36. </el-form-item>
  37. <el-form-item label="申请人" prop="applypeople">
  38. <el-input
  39. v-model="queryParams.applypeople"
  40. placeholder="请输入申请人"
  41. clearable
  42. @keyup.enter.native="handleQuery"
  43. />
  44. </el-form-item>
  45. <el-form-item label="审批人" prop="approval">
  46. <el-input
  47. v-model="queryParams.approval"
  48. placeholder="请输入审批人"
  49. clearable
  50. @keyup.enter.native="handleQuery"
  51. />
  52. </el-form-item>
  53. <el-form-item label="审批时间" prop="approvaltime">
  54. <el-date-picker clearable
  55. v-model="queryParams.approvaltime"
  56. type="date"
  57. style="width: 205px;"
  58. value-format="yyyy-MM-dd"
  59. placeholder="请选择审批时间">
  60. </el-date-picker>
  61. </el-form-item>
  62. <el-form-item label="状态" prop="state">
  63. <el-input
  64. v-model="queryParams.state"
  65. placeholder="请输入状态"
  66. clearable
  67. @keyup.enter.native="handleQuery"
  68. />
  69. </el-form-item>
  70. <el-form-item>
  71. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  72. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  73. </el-form-item>
  74. </el-form>
  75. <el-row :gutter="10" class="mb8">
  76. <el-col :span="1.5">
  77. <el-button
  78. type="primary"
  79. plain
  80. icon="el-icon-plus"
  81. size="mini"
  82. @click="handleAdd"
  83. v-hasPermi="['amichi:purchaseOrder:add']"
  84. >新增</el-button>
  85. </el-col>
  86. <el-col :span="1.5">
  87. <el-button
  88. type="success"
  89. plain
  90. icon="el-icon-edit"
  91. size="mini"
  92. :disabled="single"
  93. @click="handleUpdate"
  94. v-hasPermi="['amichi:purchaseOrder:edit']"
  95. >修改</el-button>
  96. </el-col>
  97. <el-col :span="1.5">
  98. <el-button
  99. type="danger"
  100. plain
  101. icon="el-icon-delete"
  102. size="mini"
  103. :disabled="multiple"
  104. @click="handleDelete"
  105. v-hasPermi="['amichi:purchaseOrder:remove']"
  106. >删除</el-button>
  107. </el-col>
  108. <el-col :span="1.5">
  109. <el-button
  110. type="warning"
  111. plain
  112. icon="el-icon-download"
  113. size="mini"
  114. @click="handleExport"
  115. v-hasPermi="['amichi:purchaseOrder:export']"
  116. >导出</el-button>
  117. </el-col>
  118. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  119. </el-row>
  120. <el-table v-loading="loading" style="margin-top: 20px" :data="purchaseOrderList" @selection-change="handleSelectionChange">
  121. <el-table-column type="selection" width="55" align="center" />
  122. <el-table-column label="主键" align="center" prop="id" />
  123. <el-table-column label="采购编号" align="center" prop="number" />
  124. <el-table-column label="申请组织" align="center" prop="apply" />
  125. <el-table-column label="申请时间" align="center" prop="currency"/>
  126. <el-table-column label="申请部门" align="center" prop="department" />
  127. <el-table-column label="合计金额" align="center" prop="total" />
  128. <el-table-column label="申请人" align="center" prop="applypeople" />
  129. <el-table-column label="创建人" align="center" prop="createpeople" />
  130. <!-- <el-table-column label="备用" align="center" prop="sparea" />-->
  131. <el-table-column label="状态" align="center" prop="state" >
  132. <template v-slot="scope">
  133. <el-tag :type="getStatusType(scope.row.state)" disable-transitions> <dict-tag :options="dict.type.cgspzt" :value="scope.row.state"/></el-tag>
  134. </template>
  135. </el-table-column>
  136. <el-table-column label="审批人" align="center" prop="approval" />
  137. <el-table-column label="审批时间" align="center" prop="approvaltime"/>
  138. <el-table-column label="备注" align="center" prop="remark" />
  139. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  140. <template slot-scope="scope">
  141. <el-dropdown @command="(command)=>{handleCommand(command, scope.row)}">
  142. <el-button type="warning">
  143. 操作<i class="el-icon-arrow-down el-icon--right"></i>
  144. </el-button>
  145. <el-dropdown-menu slot="dropdown">
  146. <el-dropdown-item icon="el-icon-edit" command="handleUpdate">修改</el-dropdown-item>
  147. <el-dropdown-item icon="el-icon-delete" command="handleDelete">删除</el-dropdown-item>
  148. <el-dropdown-item icon="el-icon-delete" command="initiateApproval">发起审批</el-dropdown-item>
  149. <el-dropdown-item icon="el-icon-delete" command="catDetails">查看详情</el-dropdown-item>
  150. </el-dropdown-menu>
  151. </el-dropdown>
  152. </template>
  153. </el-table-column>
  154. </el-table>
  155. <pagination
  156. v-show="total>0"
  157. :total="total"
  158. :page.sync="queryParams.pageNum"
  159. :limit.sync="queryParams.pageSize"
  160. @pagination="getList"
  161. />
  162. <!-- 添加或修改采购对话框 -->
  163. <el-dialog title="查看详情" :visible.sync="catOpen" width="1000px" append-to-body>
  164. <el-row type="flex" class="row-bg" justify="space-between">
  165. <el-col :span="6"><div class="bt">单据编号</div></el-col>
  166. <el-col :span="6"><div class="bt">申请组织</div></el-col>
  167. <el-col :span="6"><div class="bt" style="padding-left: 27px">币别</div></el-col>
  168. </el-row>
  169. <el-row type="flex" class="row-bg" justify="space-between">
  170. <el-col :span="6"><div class="bt">申请日期</div></el-col>
  171. <el-col :span="6"><div class="bt">申请部门</div></el-col>
  172. <el-col :span="6"><div class="bt">合计金额</div></el-col>
  173. </el-row>
  174. </el-dialog>
  175. <!-- 添加或修改采购对话框 -->
  176. <el-dialog :title="title" :visible.sync="open" width="1200px" append-to-body>
  177. <el-form ref="form" :model="form" :rules="rules" label-width="80px">
  178. <el-row type="flex" class="row-bg" justify="space-between">
  179. <el-col :span="8">
  180. <el-form-item label="采购编号" prop="number">
  181. <el-input v-model="form.number" placeholder="请输入采购编号" />
  182. </el-form-item>
  183. </el-col>
  184. <el-col :span="8">
  185. <el-form-item label="申请组织" prop="apply">
  186. <el-input v-model="form.apply" placeholder="请输入申请组织" />
  187. </el-form-item>
  188. </el-col>
  189. <el-col :span="8">
  190. <el-form-item label="申请时间" prop="applytime">
  191. <el-date-picker clearable
  192. v-model="form.applytime"
  193. type="date"
  194. style="width: 306.32px"
  195. value-format="yyyy-MM-dd"
  196. placeholder="请选择申请时间">
  197. </el-date-picker>
  198. </el-form-item>
  199. </el-col>
  200. </el-row>
  201. <el-row type="flex" class="row-bg" justify="space-between">
  202. <el-col :span="8">
  203. <el-form-item label="申请部门" prop="department">
  204. <el-input v-model="form.department" placeholder="请输入申请部门" />
  205. </el-form-item>
  206. </el-col>
  207. <el-col :span="8">
  208. <el-form-item label="币别" prop="currency">
  209. <el-input v-model="form.currency" placeholder="请输入申请组织" />
  210. </el-form-item>
  211. </el-col>
  212. <el-col :span="8">
  213. <el-form-item label="合计金额" prop="total">
  214. <el-input v-model="form.total" placeholder="请输入合计金额" />
  215. </el-form-item>
  216. </el-col>
  217. </el-row>
  218. <el-row type="flex" class="row-bg">
  219. <el-col :span="8">
  220. <el-form-item label="申请人" prop="applypeople">
  221. <el-input v-model="form.applypeople" placeholder="请输入申请人" />
  222. </el-form-item>
  223. </el-col>
  224. <el-col :span="8">
  225. <!-- type="textarea"-->
  226. <el-form-item label="备注" prop="applypeople">
  227. <el-input v-model="form.remark" placeholder="请输入备注" />
  228. </el-form-item>
  229. </el-col>
  230. </el-row>
  231. <el-row class="">
  232. <div class="cesiumTabRoot">
  233. <el-table
  234. :data="detailData"
  235. border
  236. show-summary
  237. :summary-method="getSummaries"
  238. :cell-class-name="tabCellClassName"
  239. :row-class-name="tabRowClassName"
  240. @cell-click="cellClick"
  241. style="width:100%">
  242. <el-table-column
  243. type="index"
  244. label="序号"
  245. align="center"
  246. width="50">
  247. </el-table-column>
  248. <el-table-column
  249. prop="organization"
  250. align="center"
  251. label="采购组织"
  252. >
  253. <template v-slot="{ row, column }">
  254. <el-input
  255. v-if="rowIndex === row.index && columnIndex === column.index"
  256. v-model="row.organization"
  257. @blur="hideInput(detailData,row.index,columnIndex,'organization')"
  258. >
  259. </el-input>
  260. <!-- 显示 -->
  261. <span v-else>{{ row.organization }}</span>
  262. </template>
  263. </el-table-column>
  264. <el-table-column
  265. prop="demand"
  266. label="需求组织"
  267. align="center"
  268. >
  269. <template v-slot="{ row, column }">
  270. <el-input
  271. v-if="rowIndex === row.index && columnIndex === column.index"
  272. v-model="row.demand"
  273. @blur="hideInput"></el-input>
  274. <!-- 显示 -->
  275. <span v-else>{{ row.demand }}</span>
  276. </template>
  277. </el-table-column>
  278. <el-table-column
  279. prop="materialnum"
  280. label="物料编码"
  281. align="center"
  282. >
  283. <template v-slot="{ row, column }">
  284. <!-- 编辑 -->
  285. <el-input
  286. v-if="rowIndex === row.index && columnIndex === column.index"
  287. v-model="row.materialnum"
  288. @blur="hideInput"></el-input>
  289. <!-- 显示 -->
  290. <span v-else>{{ row.materialnum }}</span>
  291. </template>
  292. </el-table-column>
  293. <el-table-column
  294. prop="materialname"
  295. align="center"
  296. :label="'物料名称'">
  297. <template v-slot="{ row, column }">
  298. <!-- 编辑 -->
  299. <el-input
  300. v-if="rowIndex === row.index && columnIndex === column.index"
  301. v-model="row.materialname"
  302. @blur="hideInput"></el-input>
  303. <!-- 显示 -->
  304. <span v-else>{{ row.materialname }}</span>
  305. </template>
  306. </el-table-column>
  307. <el-table-column
  308. prop="model"
  309. label="规格型号"
  310. align="center"
  311. >
  312. <template v-slot="{ row, column }">
  313. <!-- 编辑 -->
  314. <el-input
  315. v-if="rowIndex === row.index && columnIndex === column.index"
  316. v-model="row.model"
  317. @blur="hideInput"></el-input>
  318. <!-- 显示 -->
  319. <span v-else>{{ row.model }}</span>
  320. </template>
  321. </el-table-column>
  322. <el-table-column
  323. prop="company"
  324. label="单位"
  325. align="center"
  326. >
  327. <template v-slot="{ row, column }">
  328. <!-- 编辑 -->
  329. <el-input
  330. v-if="rowIndex === row.index && columnIndex === column.index"
  331. v-model="row.company"
  332. @blur="hideInput"></el-input>
  333. <!-- 显示 -->
  334. <span v-else>{{ row.company }}</span>
  335. </template>
  336. </el-table-column>
  337. <el-table-column
  338. prop="quantity"
  339. label="申请数量"
  340. align="center"
  341. sortable
  342. >
  343. <template v-slot="{ row, column }">
  344. <!-- 编辑 -->
  345. <el-input
  346. v-if="rowIndex === row.index && columnIndex === column.index"
  347. v-model="row.quantity"
  348. @blur="hideInput('sl')"></el-input>
  349. <!-- 显示 -->
  350. <span v-else>{{ row.quantity }}</span>
  351. </template>
  352. </el-table-column>
  353. <el-table-column
  354. prop="approval"
  355. label="批准数量"
  356. align="center"
  357. sortable
  358. >
  359. <template v-slot="{ row, column }">
  360. <!-- 编辑 -->
  361. <el-input
  362. v-if="rowIndex === row.index && columnIndex === column.index"
  363. v-model="row.approval"
  364. @blur="hideInput('sl')"></el-input>
  365. <!-- 显示 -->
  366. <span v-else>{{ row.approval }}</span>
  367. </template>
  368. </el-table-column>
  369. <el-table-column
  370. prop="remark"
  371. label="到货日期"
  372. align="center"
  373. width="180"
  374. >
  375. <template v-slot="{ row, column }">
  376. <!-- 编辑 -->
  377. <el-date-picker
  378. style="width: 100%"
  379. v-if="rowIndex === row.index && columnIndex === column.index"
  380. v-model="row.reachtime"
  381. prop
  382. type="date"
  383. @blur="hideInput"
  384. value-format="yyyy-MM-dd"
  385. placeholder="选择日期">
  386. </el-date-picker>
  387. <!-- 显示 -->
  388. <span v-else>{{ row.reachtime }}</span>
  389. </template>
  390. </el-table-column>
  391. <el-table-column
  392. prop="remark"
  393. label="备注"
  394. align="center"
  395. >
  396. <template v-slot="{ row, column }">
  397. <!-- 编辑 -->
  398. <el-input
  399. v-if="rowIndex === row.index && columnIndex === column.index"
  400. v-model="row.remark"
  401. prop
  402. @blur="hideInput"></el-input>
  403. <!-- 显示 -->
  404. <span v-else>{{ row.remark }}</span>
  405. </template>
  406. </el-table-column>
  407. <el-table-column
  408. align="center"
  409. fixed="right"
  410. label="操作"
  411. width="120">
  412. <template v-slot="scope">
  413. <el-button type="danger" size="small" icon="el-icon-delete" @click.native.prevent="deleteRow(scope.$index, detailData)"></el-button>
  414. </template>
  415. </el-table-column>
  416. </el-table>
  417. </div>
  418. </el-row>
  419. <el-row type="flex" class="row-bg" justify="space-between" style="margin-top: 20px">
  420. <el-col :span="10">
  421. </el-col>
  422. <el-col :span="10">
  423. <el-button type="primary" style="float: right" icon="el-icon-circle-plus" @click="addDetails">新增明细</el-button>
  424. </el-col>
  425. </el-row>
  426. <!-- <el-row type="flex" class="row-bg" justify="space-between" style="margin-top: 20px">-->
  427. <!-- <el-col :span="12">-->
  428. <!-- <el-form-item label="创建人" prop="createpeople">-->
  429. <!-- <el-input v-model="form.createpeople" placeholder="请输入创建人" />-->
  430. <!-- </el-form-item>-->
  431. <!-- </el-col>-->
  432. <!-- <el-col :span="12">-->
  433. <!-- <el-form-item label="审批人" prop="approval">-->
  434. <!-- <el-input v-model="form.approval" placeholder="请输入审批人" />-->
  435. <!-- </el-form-item>-->
  436. <!-- </el-col>-->
  437. <!-- </el-row>-->
  438. <!-- <el-form-item label="审批时间" prop="approvaltime">-->
  439. <!-- <el-date-picker clearable-->
  440. <!-- v-model="form.approvaltime"-->
  441. <!-- type="date"-->
  442. <!-- value-format="yyyy-MM-dd"-->
  443. <!-- placeholder="审批时间">-->
  444. <!-- </el-date-picker>-->
  445. <!-- </el-form-item>-->
  446. <!-- <el-form-item label="审批时间" prop="createTime">-->
  447. <!-- <el-date-picker clearable-->
  448. <!-- v-model="form.createTime"-->
  449. <!-- type="date"-->
  450. <!-- value-format="yyyy-MM-dd"-->
  451. <!-- placeholder="创建时间">-->
  452. <!-- </el-date-picker>-->
  453. <!-- </el-form-item>-->
  454. </el-form>
  455. <div slot="footer" class="dialog-footer">
  456. <el-button type="primary" @click="submitForm">确 定</el-button>
  457. <el-button @click="cancel">取 消</el-button>
  458. </div>
  459. </el-dialog>
  460. </div>
  461. </template>
  462. <script>
  463. import {
  464. listPurchaseOrder,
  465. addPurchaseOrderVo,
  466. getPurchaseOrderOne,
  467. getPurchaseOrder,
  468. updatePurchaseOrderVo,
  469. delPurchaseOrder,
  470. addPurchaseOrder,
  471. updatePurchaseOrder,
  472. updatePurchaseOrderState
  473. } from "@/api/amichi/purchase/purchaseOrder";
  474. export default {
  475. name: "PurchaseOrder",
  476. dicts: ["cgspzt"],
  477. data() {
  478. return {
  479. catOpen:false,
  480. // 行index
  481. rowIndex: null,
  482. // 列index
  483. columnIndex: null,
  484. detailData:[],
  485. // 遮罩层
  486. loading: true,
  487. // 选中数组
  488. ids: [],
  489. // 非单个禁用
  490. single: true,
  491. // 非多个禁用
  492. multiple: true,
  493. // 显示搜索条件
  494. showSearch: true,
  495. // 总条数
  496. total: 0,
  497. // 采购表格数据
  498. purchaseOrderList: [],
  499. // 弹出层标题
  500. title: "",
  501. // 是否显示弹出层
  502. open: false,
  503. // 查询参数
  504. queryParams: {
  505. pageNum: 1,
  506. pageSize: 10,
  507. number: null,
  508. apply: null,
  509. currency: null,
  510. department: null,
  511. total: null,
  512. applypeople: null,
  513. createpeople: null,
  514. approval: null,
  515. approvaltime: null,
  516. sparea: null,
  517. state: null,
  518. createById: null,
  519. updateById: null,
  520. dataApprovalStatus: null,
  521. processKey: null,
  522. taskProcessKey: null,
  523. taskNodeKey: null
  524. },
  525. // 表单参数
  526. form: {},
  527. // 表单校验
  528. rules: {
  529. }
  530. };
  531. },
  532. created() {
  533. this.getList();
  534. },
  535. methods: {
  536. //展示不同的标签
  537. getStatusType(status) {
  538. switch (status) {
  539. case '3':
  540. return 'warning';
  541. case '0':
  542. return 'danger';
  543. case '1':
  544. return 'success';
  545. case '2':
  546. return 'info';
  547. default:
  548. return '';
  549. }
  550. },
  551. //下拉菜单点击事件
  552. handleCommand(command, row) {
  553. switch (command) {
  554. case "handleUpdate":
  555. this.handleUpdate(row)
  556. break;
  557. case "handleDelete":
  558. this.handleDelete(row)
  559. break;
  560. case "initiateApproval":
  561. this.initiateApproval(row)
  562. break;
  563. case "catDetails":
  564. this.catDetails(row)
  565. break;
  566. default:
  567. break;
  568. }
  569. },
  570. //查看详情
  571. catDetails(row){
  572. this.catOpen=true;
  573. },
  574. initiateApproval(row){
  575. //发起审批改状态
  576. let data={"id":row.id,state:0}
  577. updatePurchaseOrderState(data).then((res)=>{
  578. this.$modal.msgSuccess("发起审批成功");
  579. this.getList();
  580. });
  581. },
  582. // 对列进行合算
  583. getSummaries(param) {
  584. const { columns, data } = param;
  585. const sums = [];
  586. columns.forEach((column, index) => {
  587. if (index === 0) {
  588. sums[index] = '合计';
  589. return;
  590. }
  591. const values = data.map(item => Number(item[column.property]));
  592. // 只对amount这一列进行总计核算。
  593. if (column.property === 'quantity') {
  594. if (!values.every(value => isNaN(value))) {
  595. sums[index] = values.reduce((prev, curr) => {
  596. const value = Number(curr);
  597. if (!isNaN(value)) {
  598. return prev + curr;
  599. }else {
  600. return prev;
  601. }
  602. }, 0);
  603. // sums[index] += ' 元';
  604. } else {
  605. // sums[index] = '---'
  606. }
  607. }
  608. if (column.property === 'approval') {
  609. if (!values.every(value => isNaN(value))) {
  610. sums[index] = values.reduce((prev, curr) => {
  611. const value = Number(curr);
  612. if (!isNaN(value)) {
  613. return prev + curr;
  614. }else {
  615. return prev;
  616. }
  617. }, 0);
  618. // sums[index] += ' 元';
  619. } else {
  620. // sums[index] = '---'
  621. }
  622. }
  623. });
  624. return sums;
  625. },
  626. //新增明细
  627. addDetails(){
  628. this.detailData.push(
  629. {"organization":"","demand":"","materialnum":"","materialname":"","model":"","company":"","quantity":0,"approval":0,"reachtime":"","remark":""});
  630. },
  631. deleteRow(index, rows) {
  632. rows.splice(index, 1);
  633. },
  634. // 表格input失去焦点
  635. hideInput(a,b,c,d) {
  636. if(a=="sl"){
  637. this.updateTotalQuantity();
  638. }
  639. // console.log(a,b,c,d)
  640. // console.log(a[b-1])
  641. // console.log("33333")
  642. // if(a[b-1]){
  643. // console.log("a")
  644. // if(a[b-1][`${d}`]!=undefined&&a[b-1][`${d}`]!=""){
  645. // a[b-1].isEmpty[`${d}`]=false;
  646. // console.log("h")
  647. // }else {
  648. // console.log("m")
  649. // a[b-1].isEmpty[`${d}`]=true;
  650. // }
  651. // }
  652. // console.log(this.detailData)
  653. this.rowIndex = null;
  654. this.columnIndex = null;
  655. },
  656. // 点击表格单元格编辑
  657. cellClick(row, column) {
  658. this.rowIndex = row.index;
  659. this.columnIndex = column.index;
  660. },
  661. // 给表格单元格数据添加列下标
  662. tabCellClassName({ column, columnIndex }) {
  663. column.index = columnIndex + 1;
  664. },
  665. // 表格行class-name
  666. tabRowClassName({ row, rowIndex }) {
  667. row.index = rowIndex + 1;
  668. },
  669. /** 查询采购列表 */
  670. getList() {
  671. this.loading = true;
  672. listPurchaseOrder(this.queryParams).then(response => {
  673. this.purchaseOrderList = response.rows;
  674. this.total = response.total;
  675. this.loading = false;
  676. });
  677. },
  678. // 取消按钮
  679. cancel() {
  680. this.open = false;
  681. this.reset();
  682. },
  683. // 表单重置
  684. reset() {
  685. this.form = {
  686. id: null,
  687. number: null,
  688. apply: null,
  689. currency: null,
  690. department: null,
  691. total: null,
  692. applypeople: null,
  693. createpeople: null,
  694. approval: null,
  695. approvaltime: null,
  696. sparea: null,
  697. state: null,
  698. remark: null,
  699. createById: null,
  700. createBy: null,
  701. createTime: null,
  702. updateById: null,
  703. updateBy: null,
  704. updateTime: null,
  705. delFlag: null,
  706. dataApprovalStatus: null,
  707. processKey: null,
  708. taskProcessKey: null,
  709. taskNodeKey: null
  710. };
  711. this.resetForm("form");
  712. },
  713. /** 搜索按钮操作 */
  714. handleQuery() {
  715. this.queryParams.pageNum = 1;
  716. this.getList();
  717. },
  718. /** 重置按钮操作 */
  719. resetQuery() {
  720. this.resetForm("queryForm");
  721. this.handleQuery();
  722. },
  723. // 多选框选中数据
  724. handleSelectionChange(selection) {
  725. this.ids = selection.map(item => item.id)
  726. this.single = selection.length!==1
  727. this.multiple = !selection.length
  728. },
  729. /** 新增按钮操作 */
  730. handleAdd() {
  731. this.reset();
  732. this.detailData=[];
  733. this.open = true;
  734. this.title = "添加采购";
  735. },
  736. /** 修改按钮操作 */
  737. handleUpdate(row) {
  738. this.reset();
  739. this.detailData=[];
  740. const id = row.id || this.ids
  741. getPurchaseOrderOne(id).then(response => {
  742. this.form = response.data;
  743. this.detailData = response.data.pocurementdetailsList;
  744. this.open = true;
  745. this.title = "修改采购";
  746. });
  747. },
  748. /** 提交按钮 */
  749. submitForm() {
  750. this.$refs["form"].validate(valid => {
  751. if (valid) {
  752. if (this.form.id != null) {
  753. this.form.pocurementdetailsList = this.detailData;
  754. updatePurchaseOrderVo(this.form).then(response => {
  755. this.$modal.msgSuccess("修改成功");
  756. this.open = false;
  757. this.getList();
  758. });
  759. } else {
  760. this.form.pocurementdetailsList = this.detailData;
  761. addPurchaseOrderVo(this.form).then(response => {
  762. this.$modal.msgSuccess("新增成功");
  763. this.open = false;
  764. this.getList();
  765. });
  766. }
  767. }
  768. });
  769. },
  770. /** 删除按钮操作 */
  771. handleDelete(row) {
  772. const ids = row.id || this.ids;
  773. this.$modal.confirm('是否确认删除采购编号为"' + ids + '"的数据项?').then(function() {
  774. return delPurchaseOrder(ids);
  775. }).then(() => {
  776. this.getList();
  777. this.$modal.msgSuccess("删除成功");
  778. }).catch(() => {});
  779. },
  780. /** 导出按钮操作 */
  781. handleExport() {
  782. this.download('amichi/purchaseOrder/export', {
  783. ...this.queryParams
  784. }, `purchaseOrder_${new Date().getTime()}.xlsx`)
  785. }
  786. }
  787. };
  788. </script>
  789. <style>
  790. .bt{
  791. text-align: left;
  792. border: 1px solid red;
  793. }
  794. </style>