index.vue 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742
  1. <template>
  2. <div id="PurchaseDemandList">
  3. <div v-if="isList">
  4. <el-card style="position: relative;">
  5. <el-form class="search_area" label-width="100px">
  6. <el-row :gutter="10">
  7. <el-col :span="1.5">
  8. <el-form-item label="单据编码">
  9. <el-input
  10. v-model.trim="queryParams.code"
  11. size="mini"
  12. clearable
  13. style="width: 200px"
  14. />
  15. </el-form-item>
  16. </el-col>
  17. <el-col :span="1.5">
  18. <el-form-item label="需求客户">
  19. <el-select clearable size="mini" v-model="queryParams.customer" @focus="chooseOrg('CUSTOMER_PARAM', true, '需求客户')" style="width: 200px">
  20. <el-option v-for="item in customerOptions" :key="item.id" :label="item.name" :value="item.id" />
  21. </el-select>
  22. </el-form-item>
  23. </el-col>
  24. <el-col :span="1.5">
  25. <el-form-item label="是否客户指定">
  26. <el-select clearable v-model="queryParams.isProcess" size="mini" style="width: 200px" placeholder="请选择">
  27. <el-option
  28. v-for="item in options"
  29. :key="item.value"
  30. :label="item.label"
  31. :value="item.value">
  32. </el-option>
  33. </el-select>
  34. </el-form-item>
  35. </el-col>
  36. <el-col :span="1.5">
  37. <el-form-item label="需求人员">
  38. <el-select clearable size="mini" v-model="queryParams.demandPersonal" @focus="chooseOrg('CONTACTS_PARAM', true, '需求人员')" style="width: 200px">
  39. <el-option v-for="item in personOptions" :key="item.id" :label="item.name" :value="item.code" />
  40. </el-select>
  41. </el-form-item>
  42. </el-col>
  43. <!-- <el-col :span="1.5"> -->
  44. <!-- <el-form-item label="" label-width="20px"> -->
  45. <div style="position: absolute;top: 3px;right: 10px;">
  46. <el-button type="primary" size="mini" icon="el-icon-search" @click="searchList">搜索</el-button>
  47. <el-button size="mini" icon="el-icon-refresh" plain @click="resetList">重置</el-button>
  48. </div>
  49. <!-- </el-form-item> -->
  50. <!-- </el-col> -->
  51. </el-row>
  52. <CollapseTransition>
  53. <div v-show="expanded">
  54. <el-row :gutter="10">
  55. <el-col :span="1.5">
  56. <el-form-item label="单据来源">
  57. <el-select clearable v-model="queryParams.source" size="mini" style="width: 200px">
  58. <el-option v-for="dict in dict.type.sys_bill_source" :key="dict.value" :label="dict.label" :value="dict.value">
  59. </el-option>
  60. </el-select>
  61. </el-form-item>
  62. </el-col>
  63. <el-col :span="1.5">
  64. <el-form-item label="业务类型">
  65. <el-select clearable v-model="queryParams.billType" size="mini" style="width: 200px">
  66. <el-option v-for=" dict in dict.type.sys_business" :key="dict.value" :label="dict.label" :value="dict.value">
  67. </el-option>
  68. </el-select>
  69. </el-form-item>
  70. </el-col>
  71. <el-col :span="1.5">
  72. <el-form-item label="需求部门">
  73. <el-select clearable v-model="queryParams.demandDept" size="mini" @focus="chooseOrg('DEPT_PARAM', true, '需求部门')" style="width: 200px">
  74. <el-option
  75. v-for="item in deptOptions"
  76. :key="item.id"
  77. :label="item.name"
  78. :value="item.id">
  79. </el-option>
  80. </el-select>
  81. </el-form-item>
  82. </el-col>
  83. <el-col :span="1.5">
  84. <el-form-item label="需求日期">
  85. <el-date-picker
  86. v-model="queryParams.demandDate"
  87. type="date"
  88. clearable
  89. value-format="yyyy-MM-dd"
  90. size="mini"
  91. style="width: 200px"
  92. >
  93. </el-date-picker>
  94. </el-form-item>
  95. </el-col>
  96. </el-row>
  97. <el-row :gutter="10">
  98. <el-col :span="1.5">
  99. <el-form-item label="物料编码">
  100. <el-input
  101. v-model.trim="queryParams.materialCode"
  102. size="mini"
  103. clearable
  104. style="width: 200px"
  105. />
  106. </el-form-item>
  107. </el-col>
  108. <el-col :span="1.5">
  109. <el-form-item label="单据状态">
  110. <el-select clearable v-model="queryParams.status" size="mini" style="width: 200px">
  111. <el-option v-for=" dict in dict.type.sys_status" :key="dict.value" :label="dict.label" :value="dict.value">
  112. </el-option>
  113. </el-select>
  114. </el-form-item>
  115. </el-col>
  116. <el-col :span="1.5">
  117. <el-form-item label="备注">
  118. <el-input
  119. v-model.trim="queryParams.remark"
  120. size="mini"
  121. clearable
  122. style="width: 200px"
  123. />
  124. </el-form-item>
  125. </el-col>
  126. </el-row>
  127. </div>
  128. </CollapseTransition>
  129. </el-form>
  130. <el-divider class="lines"><i style="cursor: pointer;" :class="expanded?'el-icon-arrow-up':'el-icon-arrow-down'" @click="drop"></i></el-divider>
  131. <div class="btn_grooup">
  132. <el-button type="primary" size="mini" @click="addDivision">新增</el-button>
  133. <el-dropdown size="mini" @command="handleCommand">
  134. <el-button size="mini" type="primary" style="margin-left: 10px;">
  135. 导入<i class="el-icon-arrow-down el-icon--right"></i>
  136. </el-button>
  137. <el-dropdown-menu slot="dropdown">
  138. <el-dropdown-item command="数据导入">数据导入</el-dropdown-item>
  139. <el-dropdown-item command="模板下载">模板下载</el-dropdown-item>
  140. </el-dropdown-menu>
  141. </el-dropdown>
  142. <el-dropdown size="mini" @command="handleExport">
  143. <el-button size="mini" type="primary" style="margin: 0 10px;">
  144. 导出<i class="el-icon-arrow-down el-icon--right"></i>
  145. </el-button>
  146. <el-dropdown-menu slot="dropdown">
  147. <el-dropdown-item command="选中导出">选中导出</el-dropdown-item>
  148. <el-dropdown-item command="全部导出">全部导出</el-dropdown-item>
  149. </el-dropdown-menu>
  150. </el-dropdown>
  151. <el-button type="primary" size="mini" @click="delItems">删除</el-button>
  152. <!-- <el-button type="primary" size="mini">打印</el-button> -->
  153. </div>
  154. <el-table
  155. :data="tableList"
  156. fit
  157. :cell-style="{ borderColor: '#c0c0c0' }"
  158. :header-cell-style="{ borderColor: '#c0c0c0' }"
  159. class="exporttable"
  160. max-height="410"
  161. border
  162. style="font-size: 12px;"
  163. @selection-change="handleSelectionChange"
  164. >
  165. <el-table-column show-overflow-tooltip type="selection" width="55" fixed="left"/>
  166. <el-table-column show-overflow-tooltip label="序号" type="index" align="center" width="50px" fixed="left"/>
  167. <el-table-column show-overflow-tooltip label="编码" align="center" width="170" prop="code"/>
  168. <el-table-column show-overflow-tooltip label="需求日期" align="center" width="120" prop="demandDate"/>
  169. <el-table-column show-overflow-tooltip label="审批结束日期" align="center" width="120" prop="approverFinishTime"/>
  170. <el-table-column show-overflow-tooltip label="单据状态" align="center" prop="satus" :formatter="formatterStatus"/>
  171. <el-table-column show-overflow-tooltip label="业务类型" align="center" width="120" prop="billType" :formatter="formatterBillType"/>
  172. <!-- <el-table-column show-overflow-tooltip label="是否特殊需求" align="center" width="150" prop="isSpeical" /> -->
  173. <el-table-column show-overflow-tooltip label="需求人员" align="center" prop="demandPersonalName" />
  174. <el-table-column show-overflow-tooltip label="需求客户" align="center" prop="customerName" width="150"/>
  175. <el-table-column show-overflow-tooltip label="需求部门" align="center" prop="demandDeptName" width="150"/>
  176. <!-- <el-table-column show-overflow-tooltip label="供应仓库" align="center" width="120" prop="warehouseName" /> -->
  177. <!-- <el-table-column show-overflow-tooltip label="供应货位" align="center" width="150" prop="goodsAllocationName" /> -->
  178. <el-table-column show-overflow-tooltip label="单据来源" align="center" prop="source" width="120" :formatter="formatterSource"/>
  179. <el-table-column show-overflow-tooltip label="组织" align="center" width="200" prop="orgName"/>
  180. <el-table-column show-overflow-tooltip label="备注" align="center" width="150" prop="remark" />
  181. <el-table-column
  182. fixed="right"
  183. label="操作"
  184. align="center"
  185. width="180"
  186. >
  187. <template slot-scope="scope">
  188. <el-button type="text" size="mini" @click="check(scope.row)">查看</el-button>
  189. <el-button type="text" size="mini" v-if="scope.row.status == '0' || scope.row.status == '3'" @click="edit(scope.row)">编辑</el-button>
  190. <el-button type="text" size="mini" v-if="scope.row.status == '0' || scope.row.status == '3'" @click="commit(scope.row)">提交</el-button>
  191. <el-button type="text" size="mini" v-if="scope.row.status == '0' || scope.row.status == '3'" @click="deleteids(scope.row)">删除</el-button>
  192. </template>
  193. </el-table-column>
  194. </el-table>
  195. <el-pagination
  196. background
  197. @size-change="handleSizeChange"
  198. @current-change="handleCurrentChange"
  199. :current-page="queryParams.pageNum"
  200. :page-sizes="[10, 20 ,50 ,100]"
  201. :page-size="10"
  202. layout="total, sizes, prev, pager, next, jumper"
  203. :total=total>
  204. </el-pagination>
  205. </el-card>
  206. </div>
  207. <!-- 用户导入对话框 -->
  208. <el-dialog title="数据导入" :visible.sync="upload.open" width="400px">
  209. <el-upload
  210. ref="upload"
  211. :limit="1"
  212. accept=".xlsx, .xls"
  213. :headers="upload.headers"
  214. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  215. :disabled="upload.isUploading"
  216. :on-progress="handleFileUploadProgress"
  217. :on-success="handleFileSuccess"
  218. :on-error="errorFile"
  219. :auto-upload="false"
  220. drag
  221. >
  222. <i class="el-icon-upload"></i>
  223. <div class="el-upload__text">
  224. 将文件拖到此处,或
  225. <em>点击上传</em>
  226. </div>
  227. <!-- <div class="el-upload__tip" slot="tip">
  228. <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
  229. </div> -->
  230. <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
  231. </el-upload>
  232. <div slot="footer">
  233. <el-button size="mini" type="primary" @click="submitFileForm">确 定</el-button>
  234. <el-button size="mini" @click="upload.open = false">取 消</el-button>
  235. </div>
  236. </el-dialog>
  237. <!-- 模板下载新增参数 -->
  238. <el-dialog title="需求模板下载" :visible.sync="download.open" @close="clearDownload" width="400px">
  239. <el-row style="margin-bottom: 20px;">
  240. <span style="margin-right: 10px;">需求客户</span>
  241. <el-select clearable size="mini" v-model="download.customer" @clear="download.customer = ''" @focus="chooseOrg('CUSTOMER_PARAM', true, '选择客户')">
  242. <el-option v-for="item in mBcustomer" :key="item.id" :label="item.name" :value="item.code" />
  243. </el-select>
  244. </el-row>
  245. <el-row style="margin-bottom: 20px;">
  246. <span style="margin-right: 10px;">供应仓库</span>
  247. <el-select clearable size="mini" v-model="download.warehouse" @clear="cleanMb" @focus="chooseOrg('WAREHOUSE_PARAM', true, '选择仓库')">
  248. <el-option v-for="item in mBwarehouse" :key="item.id" :label="item.name" :value="item.code" />
  249. </el-select>
  250. </el-row>
  251. <el-row style="margin-bottom: 20px;">
  252. <span style="margin-right: 10px;">供应货位</span>
  253. <el-select clearable size="mini" v-model="download.cargoSpace" @clear="download.cargoSpace = ''" @focus="mbHuowei('ALLOCATION_PARAM', true, '选择货位', download.warehouseId)">
  254. <el-option v-for="item in mBcargoSpace" :key="item.id" :label="item.name" :value="item.code" />
  255. </el-select>
  256. </el-row>
  257. <el-row style="margin-bottom: 20px;">
  258. <span style="margin-right: 10px;">品类选择</span>
  259. <el-select
  260. v-model="download.category"
  261. size="mini"
  262. clearable
  263. @focus="chooseTreeRefer('MATERIALCLASSIFY_PARAM', false, '选择品类')"
  264. >
  265. <el-option v-for="item in classOptions" :key="item.id" :label="item.name" :value="item.code" />
  266. </el-select>
  267. </el-row>
  268. <div slot="footer">
  269. <el-button size="mini" type="primary" @click="mbDownload">模板下载</el-button>
  270. <el-button size="mini" @click="download.open = false">取 消</el-button>
  271. </div>
  272. </el-dialog>
  273. <Add v-model="isList" v-if="!isList" :pageStu="page" :disable="disable" :row="rowDetail" @refresh="searchList"/>
  274. <Refers ref="refer" @doSubmit="selectionsToInput" :single="true"/>
  275. <TreeRefers ref="tree" @doSubmit="selectionsToInput2" :single="true"/>
  276. </div>
  277. </template>
  278. <script>
  279. // 导入的token
  280. import { getToken } from "@/utils/auth";
  281. import Add from './add.vue'
  282. import Refers from '@/components/Refers/refers.vue'
  283. import TreeRefers from '@/components/Refers/treeRefer.vue'
  284. import CollapseTransition from '@/components/MyCollapse/collapse.vue'
  285. import {getDemandList, delDemand, downLoadDemand, exportDemand, submitDemand } from '@/api/purchase/purchaseDemand.js'
  286. export default {
  287. name: 'PurchaseDemandList',
  288. components: {
  289. Add,
  290. CollapseTransition,
  291. Refers,
  292. TreeRefers
  293. },
  294. dicts: ['sys_processing_mode', 'sys_status', 'sys_bill_source', 'sys_business', 'sys_reserve_ratio', 'sys_period_unit', 'sys_price_type'],
  295. data() {
  296. return {
  297. // 导入参数
  298. upload: {
  299. // 是否显示弹出层(导入)
  300. open: false,
  301. // 弹出层标题(导入)
  302. title: "数据导入",
  303. // 是否禁用上传
  304. isUploading: false,
  305. // 是否更新已经存在的用户数据
  306. updateSupport: 1,
  307. // 设置上传的请求头部
  308. headers: { Authorization: "Bearer " + getToken() },
  309. // 上传的地址
  310. url: process.env.VUE_APP_BASE_API + "/pu/demand/import"
  311. },
  312. // 模板下载参数
  313. download: {
  314. open: false,
  315. customer: '',
  316. warehouse: '',
  317. warehouseId: '',
  318. cargoSpace: '',
  319. category: ''
  320. },
  321. mBcustomer: [],
  322. mBwarehouse: [],
  323. mBcargoSpace: [],
  324. classOptions: [],
  325. // 下拉收起配置
  326. expanded: false,
  327. // 页面配置
  328. isList: true,
  329. // 页面状态
  330. page: '',
  331. queryParams: {
  332. code: '',
  333. customer: '',
  334. isProcess: '',
  335. demandPersonal: '',
  336. source: '',
  337. billType: '',
  338. demandDept: '',
  339. demandDate: '',
  340. remark: '',
  341. materialCode: '',
  342. status: '',
  343. pageNum: 1,
  344. pageSize: 10
  345. },
  346. referCondition: {
  347. type: '',
  348. isPage: true,
  349. title: ''
  350. },
  351. options: [{
  352. value: 'Y', label: '是',
  353. }, {
  354. value: 'N', label: '否'
  355. }],
  356. customerOptions: [],
  357. personOptions: [],
  358. deptOptions: [],
  359. tableList: [],
  360. total: 0,
  361. rowDetail: {},
  362. disable: false,
  363. ids: []
  364. }
  365. },
  366. created() {
  367. this.getList(this.queryParams)
  368. },
  369. methods: {
  370. // 格式化表格内容
  371. formatterStatus(row) {
  372. switch(row.status){
  373. case '0':
  374. return '未提交'
  375. case '1':
  376. return '审批中'
  377. case '2':
  378. return '已完成'
  379. case '3':
  380. return '已驳回'
  381. }
  382. },
  383. formatterBillType(row) {
  384. switch (row.billType) {
  385. case 'ZQBH':
  386. return '周期备货'
  387. case 'FXXQ':
  388. return '分销需求'
  389. case 'TSXQ':
  390. return '特殊采购需求'
  391. case 'BDXQ':
  392. return '补单需求'
  393. case 'JJXQ':
  394. return '紧急需求单'
  395. case 'XPXQ':
  396. return '新品需求'
  397. case 'HZBM':
  398. return '合作部门需求'
  399. case 'DZBH':
  400. return '大宗备货'
  401. case 'XZCG':
  402. return '行政类采购'
  403. }
  404. },
  405. formatterSource(row) {
  406. switch (row.source) {
  407. case '1':
  408. return '手工导入'
  409. case '2':
  410. return '按客户计算'
  411. case '3':
  412. return '按仓库计算'
  413. case '4':
  414. return '手工新增'
  415. }
  416. },
  417. searchList() {
  418. this.getList(this.queryParams)
  419. },
  420. resetList() {
  421. this.queryParams = {
  422. code: '',
  423. customer: '',
  424. isProcess: '',
  425. demandPersonal: '',
  426. source: '',
  427. billType: '',
  428. demandDept: '',
  429. demandDate: '',
  430. remark: '',
  431. materialCode: '',
  432. status: '',
  433. pageNum: 1,
  434. pageSize: 10
  435. }
  436. this.getList(this.queryParams)
  437. },
  438. getList(params){
  439. getDemandList(params).then(res => {
  440. if (res.code === 200) {
  441. this.tableList = res.rows
  442. this.total = res.total
  443. }
  444. })
  445. },
  446. handleSelectionChange(selection) {
  447. console.log('选中', selection)
  448. this.ids = selection.map(item => item.id)
  449. console.log('选中数组', this.ids.join())
  450. },
  451. mbDownload() {
  452. downLoadDemand(this.download).then(res => {
  453. console.log('下载的文件流', res)
  454. const blob = new Blob([res], {
  455. type: "application/vnd.ms-excel;charset=UTF-8",
  456. });// 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
  457. const downloadElement = document.createElement("a"); //创建a标签
  458. const href = window.URL.createObjectURL(blob); // 创建下载的链接
  459. // var temp = res.headers["content-disposition"];
  460. // var fileName = decodeURIComponent(temp.split("filename=")[1]); // 中文需要转码 (前端乱码)
  461. // var name = fileName.split(";")[0]; //切割成文件名
  462. downloadElement.href = href; //下载地址
  463. downloadElement.download = '模板'; // 下载后文件名
  464. document.body.appendChild(downloadElement);
  465. downloadElement.click(); // 点击下载
  466. document.body.removeChild(downloadElement); // 下载完成移除元素
  467. window.URL.revokeObjectURL(href); // 释放blob对象
  468. this.download.open = false
  469. })
  470. },
  471. // 关闭模板下载弹窗清空参数
  472. clearDownload() {
  473. // 模板下载参数
  474. this.download = {
  475. open: false,
  476. customer: '',
  477. warehouse: '',
  478. warehouseId: '',
  479. cargoSpace: '',
  480. category: ''
  481. }
  482. },
  483. handleCommand(command) {
  484. // alert(command)
  485. if(command == '模板下载') {
  486. this.download.open = true
  487. }
  488. if (command == '数据导入') {
  489. this.upload.title = "用户导入"
  490. this.upload.open = true
  491. }
  492. },
  493. // 文件上传中处理
  494. handleFileUploadProgress(event, file, fileList) {
  495. this.upload.isUploading = true;
  496. },
  497. // 文件上传成功处理
  498. handleFileSuccess(response, file, fileList) {
  499. this.upload.open = false;
  500. this.upload.isUploading = false;
  501. this.$refs.upload.clearFiles();
  502. this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
  503. this.getList(this.queryParams);
  504. },
  505. errorFile(err) {
  506. this.$modal.notifyError("文件已变动,请重新上传");
  507. },
  508. // 提交上传文件
  509. submitFileForm() {
  510. this.$refs.upload.submit();
  511. },
  512. handleExport(command) {
  513. if(command == '选中导出') {
  514. if (this.ids.length == 0) {
  515. this.$modal.notifyWarning("请选中至少一条数据");
  516. } else {
  517. let param = {all: false, ids: this.ids}
  518. exportDemand(param).then(res => {
  519. const blob = new Blob([res], {
  520. type: "application/vnd.ms-excel;charset=UTF-8",
  521. });// 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
  522. const downloadElement = document.createElement("a"); //创建a标签
  523. const href = window.URL.createObjectURL(blob); // 创建下载的链接
  524. // var temp = res.headers["content-disposition"];
  525. // var fileName = decodeURIComponent(temp.split("filename=")[1]); // 中文需要转码 (前端乱码)
  526. // var name = fileName.split(";")[0]; //切割成文件名
  527. downloadElement.href = href; //下载地址
  528. downloadElement.download = '选中导出'; // 下载后文件名
  529. document.body.appendChild(downloadElement);
  530. downloadElement.click(); // 点击下载
  531. document.body.removeChild(downloadElement); // 下载完成移除元素
  532. window.URL.revokeObjectURL(href); // 释放blob对象
  533. })
  534. }
  535. } else {
  536. let param2 = {all: true}
  537. exportDemand(param2).then(res => {
  538. const blob = new Blob([res], {
  539. type: "application/vnd.ms-excel;charset=UTF-8",
  540. });// 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
  541. const downloadElement = document.createElement("a"); //创建a标签
  542. const href = window.URL.createObjectURL(blob); // 创建下载的链接
  543. // var temp = res.headers["content-disposition"];
  544. // var fileName = decodeURIComponent(temp.split("filename=")[1]); // 中文需要转码 (前端乱码)
  545. // var name = fileName.split(";")[0]; //切割成文件名
  546. downloadElement.href = href; //下载地址
  547. downloadElement.download = '全部导出'; // 下载后文件名
  548. document.body.appendChild(downloadElement);
  549. downloadElement.click(); // 点击下载
  550. document.body.removeChild(downloadElement); // 下载完成移除元素
  551. window.URL.revokeObjectURL(href); // 释放blob对象
  552. })
  553. }
  554. },
  555. addDivision() {
  556. this.isList = false
  557. this.page = 'add'
  558. this.disable = false
  559. },
  560. check(row) {
  561. this.isList = false
  562. this.page = 'check'
  563. this.rowDetail = row
  564. this.disable = true
  565. },
  566. edit(row) {
  567. this.isList = false
  568. this.page = 'edit'
  569. this.rowDetail = row
  570. this.disable = false
  571. },
  572. commit(row) {
  573. console.log('row', row)
  574. this.$modal.loading("提交中...");
  575. submitDemand(row).then(res => {
  576. if (res.code === 200) {
  577. this.$modal.notifySuccess("提交成功");
  578. this.$modal.closeLoading();
  579. this.getList(this.queryParams)
  580. }
  581. }).catch(err => {
  582. this.$modal.closeLoading();
  583. })
  584. },
  585. // 行内删除
  586. deleteids(row) {
  587. console.log('row', row)
  588. this.$modal.confirm('确定删除选择数据?').then(() => {
  589. delDemand(row.id).then(res => {
  590. if (res.code === 200) {
  591. this.$modal.notifySuccess("删除成功");
  592. this.getList(this.queryParams)
  593. }
  594. })
  595. }).catch(() => {})
  596. },
  597. // 批量删除按钮
  598. delItems() {
  599. if(this.ids.length == 0) {
  600. this.$modal.notifyWarning("请选中至少一条数据");
  601. } else {
  602. let param = this.ids.join()
  603. this.$modal.confirm('确认信息').then(() => {
  604. delDemand(param).then(res => {
  605. if (res.code === 200) {
  606. this.$modal.notifySuccess("删除成功");
  607. this.getList(this.queryParams)
  608. }
  609. })
  610. }).catch(() => {})
  611. }
  612. },
  613. handleSizeChange(val) {
  614. console.log(`每页 ${val} 条`);
  615. this.queryParams.pageSize = val
  616. this.getList(this.queryParams)
  617. },
  618. handleCurrentChange(val) {
  619. console.log(`当前页: ${val}`);
  620. this.queryParams.pageNum = val
  621. this.getList(this.queryParams)
  622. },
  623. drop() {
  624. this.expanded = !this.expanded
  625. },
  626. // 搜索区参照选择
  627. chooseOrg(type, isPage, title, stordocId) {
  628. this.referCondition.type = type
  629. this.referCondition.isPage = isPage
  630. this.referCondition.title = title
  631. this.referCondition.stordocId = stordocId
  632. this.$refs.refer.init(this.referCondition)
  633. },
  634. selectionsToInput(selection) {
  635. // 搜索区选择客户
  636. if (this.referCondition.type == 'CUSTOMER_PARAM' && this.referCondition.title == '需求客户') {
  637. this.customerOptions = selection
  638. this.queryParams.customer = selection[0].id
  639. }
  640. // 模板内选择客户
  641. if (this.referCondition.type == 'CUSTOMER_PARAM' && this.referCondition.title == '选择客户') {
  642. this.mBcustomer = selection
  643. this.download.customer = selection[0].code
  644. }
  645. // 模板内选择仓库
  646. if (this.referCondition.type == 'WAREHOUSE_PARAM' && this.referCondition.title == '选择仓库') {
  647. this.mBwarehouse = selection
  648. this.download.warehouse = selection[0].code
  649. this.download.warehouseId = selection[0].id
  650. }
  651. // 模板内选择货位
  652. if (this.referCondition.type == 'ALLOCATION_PARAM' && this.referCondition.title == '选择货位') {
  653. this.mBcargoSpace = selection
  654. this.download.cargoSpace = selection[0].code
  655. }
  656. if (this.referCondition.type == 'CONTACTS_PARAM') {
  657. this.personOptions = selection
  658. this.queryParams.demandPersonal = selection[0].code
  659. }
  660. if (this.referCondition.type == 'DEPT_PARAM') {
  661. this.deptOptions = selection
  662. this.queryParams.demandDept = selection[0].id
  663. }
  664. },
  665. mbHuowei(type, isPage, title, stordocId) {
  666. this.referCondition.type = type
  667. this.referCondition.isPage = isPage
  668. this.referCondition.title = title
  669. if(stordocId) {
  670. this.referCondition.stordocId = stordocId
  671. this.$refs.refer.init(this.referCondition)
  672. } else {
  673. this.$modal.notifyWarning("请先选择仓库")
  674. }
  675. },
  676. cleanMb() {
  677. this.download.warehouse = ''
  678. this.download.warehouseId = ''
  679. },
  680. // 搜索区树形选择
  681. chooseTreeRefer(type, isPage, title) {
  682. this.referCondition.type = type
  683. this.referCondition.isPage = isPage
  684. this.referCondition.title = title
  685. this.$refs.tree.init(this.referCondition)
  686. },
  687. selectionsToInput2(selection) {
  688. this.classOptions.push(selection)
  689. this.download.category = selection.code
  690. },
  691. }
  692. }
  693. </script>
  694. <style lang="scss" scoped>
  695. #PurchaseDemandList {
  696. padding: 12px;
  697. box-sizing: border-box;
  698. overflow-y: scroll;
  699. }
  700. .btn_grooup {
  701. margin-bottom: 10px;
  702. display: flex;
  703. justify-content: flex-end;
  704. }
  705. .lines {
  706. margin-top: 0;
  707. }
  708. .el-pagination {
  709. margin-top: 10px;
  710. text-align: right;
  711. }
  712. ::v-deep .el-table__row > td {
  713. border: none;
  714. }
  715. ::v-deep .el-card .el-form-item {
  716. margin-bottom: 10px;
  717. }
  718. </style>
  719. <style>
  720. .exporttable {
  721. border: solid 1px #c0c0c0;
  722. }
  723. .el-table .el-table__header-wrapper th {
  724. font-size: 14px;
  725. }
  726. </style>