index.vue 28 KB

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