index.vue 28 KB

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