index.vue 26 KB

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