index.vue 27 KB

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