index.vue 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969
  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.isCustomerSpecified" 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" @click="searchList">搜索</el-button>
  47. <el-button size="mini" 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-select clearable v-model="queryParams.planType" size="mini" style="width: 200px">
  119. <el-option v-for="dict in dict.type.sys_plan_type" :key="dict.value" :label="dict.label" :value="dict.value">
  120. </el-option>
  121. </el-select>
  122. </el-form-item>
  123. </el-col>
  124. <el-col :span="1.5">
  125. <el-form-item label="制单日期">
  126. <el-date-picker
  127. v-model="queryParams.createTimeString"
  128. type="date"
  129. clearable
  130. value-format="yyyy-MM-dd"
  131. size="mini"
  132. style="width: 200px"
  133. >
  134. </el-date-picker>
  135. </el-form-item>
  136. </el-col>
  137. </el-row>
  138. <el-row>
  139. <el-col :span="1.5">
  140. <el-form-item label="补单供应商">
  141. <el-select clearable size="mini" v-model="queryParams.additionalSupplier" @focus="chooseOrg('SUPPLIER_PARAM', true, '供应商')" style="width: 200px">
  142. <el-option v-for="item in supplierOptions" :key="item.id" :label="item.name" :value="item.id" />
  143. </el-select>
  144. </el-form-item>
  145. </el-col>
  146. </el-row>
  147. </div>
  148. </CollapseTransition>
  149. </el-form>
  150. <el-divider class="lines"><i style="cursor: pointer;" :class="expanded?'el-icon-arrow-up':'el-icon-arrow-down'" @click="drop"></i></el-divider>
  151. <div class="btn_grooup">
  152. <el-button type="primary" size="mini" @click="demandWindow">需求窗口期</el-button>
  153. <el-button type="primary" size="mini" @click="addDivision">新增</el-button>
  154. <el-dropdown size="mini" @command="handleCommand">
  155. <el-button size="mini" type="primary" style="margin-left: 10px;">
  156. 导入<i class="el-icon-arrow-down el-icon--right"></i>
  157. </el-button>
  158. <el-dropdown-menu slot="dropdown">
  159. <el-dropdown-item command="数据导入">数据导入</el-dropdown-item>
  160. <el-dropdown-item command="模板下载">模板下载</el-dropdown-item>
  161. </el-dropdown-menu>
  162. </el-dropdown>
  163. <el-dropdown size="mini" @command="handleExport">
  164. <el-button size="mini" type="primary" style="margin: 0 10px;">
  165. 导出<i class="el-icon-arrow-down el-icon--right"></i>
  166. </el-button>
  167. <el-dropdown-menu slot="dropdown">
  168. <el-dropdown-item command="选中导出">选中导出</el-dropdown-item>
  169. <el-dropdown-item command="全部导出">全部导出</el-dropdown-item>
  170. </el-dropdown-menu>
  171. </el-dropdown>
  172. <el-button type="primary" size="mini" @click="delItems">删除</el-button>
  173. <!-- <el-button type="primary" size="mini">打印</el-button> -->
  174. </div>
  175. <el-super-ux-table
  176. v-loading="loading"
  177. v-model="tableList"
  178. :columns="TableColumns"
  179. size="mini"
  180. :dict="dict"
  181. index
  182. checkbox
  183. class="exporttable"
  184. :height=410
  185. border
  186. highlight-current-row
  187. convenitentOperation
  188. storage-key="PurchaseDemandList"
  189. style="font-size: 12px;"
  190. @selection-change="handleSelectionChange"
  191. @row-click="rowSelect"
  192. @row-dblclick="doubleClick"
  193. ref="tables"
  194. >
  195. <!-- <ux-table-column show-overflow-tooltip type="selection" width="55" fixed="left"/>
  196. <ux-table-column show-overflow-tooltip title="序号" type="index" align="center" width="50px" fixed="left"/>
  197. <ux-table-column show-overflow-tooltip title="需求单号" align="center" width="170" field="code"/>
  198. <ux-table-column show-overflow-tooltip title="需求日期" align="center" width="100" field="demandDate"/>
  199. <ux-table-column show-overflow-tooltip title="制单日期" align="center" width="100" field="createTime"/>
  200. <ux-table-column show-overflow-tooltip title="需求计划" align="center" width="120" field="planType" :formatter="formatterPlanType"/>
  201. <ux-table-column show-overflow-tooltip title="审批结束日期" align="center" width="120" field="approverFinishTime"/>
  202. <ux-table-column show-overflow-tooltip title="单据状态" align="center" field="status" :formatter="formatterStatus"/>
  203. <ux-table-column show-overflow-tooltip title="业务类型" align="center" width="120" field="billType" :formatter="formatterBillType"/>
  204. <ux-table-column show-overflow-tooltip title="需求人员" align="center" field="demandPersonalName" />
  205. <ux-table-column show-overflow-tooltip title="需求客户" align="center" field="customerName" width="150"/>
  206. <ux-table-column show-overflow-tooltip title="需求部门" align="center" field="demandDeptName" width="150"/>
  207. <ux-table-column show-overflow-tooltip title="单据来源" align="center" field="source" width="120" :formatter="formatterSource"/>
  208. <ux-table-column show-overflow-tooltip title="当前审批人" align="center" width="120" field="approveUser" />
  209. <ux-table-column show-overflow-tooltip title="备注" align="center" width="150" field="remark" /> -->
  210. <ux-table-column
  211. fixed="right"
  212. title="操作"
  213. align="center"
  214. width="180"
  215. >
  216. <template slot-scope="scope">
  217. <el-button type="text" size="mini" @click="check(scope.row)">查看</el-button>
  218. <el-button type="text" size="mini" v-if="scope.row.status == '0' || scope.row.status == '3' || scope.row.status == '9'" @click="edit(scope.row)">编辑</el-button>
  219. <el-button type="text" size="mini" v-if="scope.row.status == '0' || scope.row.status == '3' || scope.row.status == '9'" @click="commit(scope.row)">提交</el-button>
  220. <el-button type="text" size="mini" v-if="scope.row.status == '1' && scope.row.flowId" @click="reback(scope.row)">收回</el-button>
  221. <el-button type="text" size="mini" v-if="scope.row.status == '0' || scope.row.status == '3' || scope.row.status == '9'" @click="deleteids(scope.row)">删除</el-button>
  222. </template>
  223. </ux-table-column>
  224. </el-super-ux-table>
  225. <el-pagination
  226. background
  227. @size-change="handleSizeChange"
  228. @current-change="handleCurrentChange"
  229. :current-page="queryParams.pageNum"
  230. :page-sizes="[10, 20, 50, 100, 200, 500]"
  231. :page-size="50"
  232. layout="total, sizes, prev, pager, next, jumper"
  233. :total=total>
  234. </el-pagination>
  235. </el-card>
  236. </div>
  237. <!-- 用户导入对话框 -->
  238. <el-dialog title="数据导入" :visible.sync="upload.open" width="400px">
  239. <el-upload
  240. ref="upload"
  241. :limit="1"
  242. accept=".xlsx, .xls"
  243. :headers="upload.headers"
  244. :action="upload.url + '?updateSupport=' + upload.updateSupport"
  245. :disabled="upload.isUploading"
  246. :on-progress="handleFileUploadProgress"
  247. :on-success="handleFileSuccess"
  248. :on-error="errorFile"
  249. :auto-upload="false"
  250. drag
  251. >
  252. <i class="el-icon-upload"></i>
  253. <div class="el-upload__text">
  254. 将文件拖到此处,或
  255. <em>点击上传</em>
  256. </div>
  257. <!-- <div class="el-upload__tip" slot="tip">
  258. <el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据
  259. </div> -->
  260. <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
  261. </el-upload>
  262. <div slot="footer">
  263. <el-button size="mini" type="primary" @click="submitFileForm">确 定</el-button>
  264. <el-button size="mini" @click="upload.open = false">取 消</el-button>
  265. </div>
  266. </el-dialog>
  267. <!-- 模板下载新增参数 -->
  268. <el-dialog title="需求模板下载" :visible.sync="download.open" @close="clearDownload" width="400px">
  269. <el-row style="margin-bottom: 20px;">
  270. <span style="margin-right: 10px;">需求计划</span>
  271. <el-select size="mini" v-model="download.planType">
  272. <el-option v-for="dict in dict.type.sys_plan_type" :key="dict.value" :label="dict.label" :value="dict.value">
  273. </el-option>
  274. </el-select>
  275. </el-row>
  276. <el-row style="margin-bottom: 20px;">
  277. <span style="margin-right: 10px;">需求客户</span>
  278. <el-select clearable size="mini" v-model="download.customer" @clear="download.customer = ''" @focus="chooseOrg('CUSTOMER_PARAM', true, '选择客户')">
  279. <el-option v-for="item in mBcustomer" :key="item.id" :label="item.name" :value="item.code" />
  280. </el-select>
  281. </el-row>
  282. <el-row style="margin-bottom: 20px;">
  283. <span style="margin-right: 10px;">供应仓库</span>
  284. <el-select clearable size="mini" v-model="download.warehouse" @clear="cleanMb" @focus="chooseOrg('WAREHOUSE_PARAM', true, '选择仓库')">
  285. <el-option v-for="item in mBwarehouse" :key="item.id" :label="item.name" :value="item.code" />
  286. </el-select>
  287. </el-row>
  288. <el-row style="margin-bottom: 20px;">
  289. <span style="margin-right: 10px;">供应货位</span>
  290. <el-select clearable size="mini" v-model="download.cargoSpace" @clear="download.cargoSpace = ''" @focus="mbHuowei('ALLOCATION_PARAM', true, '选择货位', download.warehouseId)">
  291. <el-option v-for="item in mBcargoSpace" :key="item.id" :label="item.name" :value="item.code" />
  292. </el-select>
  293. </el-row>
  294. <el-row style="margin-bottom: 20px;">
  295. <span style="margin-right: 10px;">品类选择</span>
  296. <el-select
  297. v-model="download.category"
  298. size="mini"
  299. clearable
  300. @focus="chooseTreeRefer('MATERIALCLASSIFY_PARAM', false, '选择品类')"
  301. >
  302. <el-option v-for="item in classOptions" :key="item.id" :label="item.name" :value="item.code" />
  303. </el-select>
  304. </el-row>
  305. <div slot="footer">
  306. <el-button size="mini" type="primary" @click="mbDownload">模板下载</el-button>
  307. <el-button size="mini" @click="download.open = false">取 消</el-button>
  308. </div>
  309. </el-dialog>
  310. <!-- 需求窗口期 -->
  311. <el-dialog title="需求窗口期" :visible.sync="setDemand.open" @close="closeDemand" width="800px">
  312. <div slot="footer">
  313. <el-button size="mini" @click="setDemand.open = false">取 消</el-button>
  314. <el-button type="primary" size="mini" @click="saveDemand">保 存</el-button>
  315. </div>
  316. <el-table
  317. :data="setDemand.gridData"
  318. >
  319. <el-table-column property="ways" label="方案">
  320. <template slot-scope="scope">
  321. <el-select v-model="scope.row.ways" size="mini" disabled>
  322. <el-option v-for="dict in dict.type.sys_plan_type" :key="dict.value" :label="dict.label" :value="dict.value">
  323. </el-option>
  324. </el-select>
  325. </template>
  326. </el-table-column>
  327. <el-table-column property="category" label="类型">
  328. <template slot-scope="scope">
  329. <el-select v-model="scope.row.category" size="mini" disabled>
  330. <el-option v-for="dict in dict.type.sys_plan_type" :key="dict.value" :label="dict.label" :value="dict.value">
  331. </el-option>
  332. </el-select>
  333. </template>
  334. </el-table-column>
  335. <el-table-column property="deadline" label="截止星期/月份">
  336. <template slot-scope="scope">
  337. <el-input-number size="mini" :min=1 :max="scope.row.ways == 'ZJH' ? 7 : 12 " v-model="scope.row.deadline" clearable @input=changeDeadline(scope.row)></el-input-number>
  338. </template>
  339. </el-table-column>
  340. <el-table-column property="remark" label="备注">
  341. <template slot-scope="scope">
  342. <el-input size="mini" v-model="scope.row.remark" clearable></el-input>
  343. </template>
  344. </el-table-column>
  345. </el-table>
  346. <span style="color: red">注:周计划星期填写范围1-7,月计划填写范围1-12</span>
  347. </el-dialog>
  348. <Add v-model="isList" v-if="!isList" :pageStu="page" :disable="disable" :row="rowDetail" @refresh="searchList"/>
  349. <Refers ref="refer" @doSubmit="selectionsToInput" :single="true"/>
  350. <TreeRefers ref="tree" @doSubmit="selectionsToInput2" :single="true"/>
  351. </div>
  352. </template>
  353. <script>
  354. // 导入的token
  355. import { getToken } from "@/utils/auth";
  356. import Add from './add.vue'
  357. import Refers from '@/components/Refers/refers.vue'
  358. import TreeRefers from '@/components/Refers/sigleTreeRefer.vue'
  359. import CollapseTransition from '@/components/MyCollapse/collapse.vue'
  360. // 流程收回
  361. import { rebacktWork } from '@/api/purchase/workSpace.js'
  362. import {getDemandList, delDemand, downLoadDemand, exportDemand, submitDemand, confirmSubmit, getDemandWindowList, saveDemandWindow } from '@/api/purchase/purchaseDemand.js'
  363. export default {
  364. name: 'PurchaseDemandList',
  365. components: {
  366. Add,
  367. CollapseTransition,
  368. Refers,
  369. TreeRefers,
  370. ElSuperUxTable: () => import("@/components/super-ux-table/index.vue"),
  371. },
  372. dicts: ['sys_processing_mode', 'sys_status', 'sys_bill_source', 'sys_business', 'sys_reserve_ratio', 'sys_period_unit', 'sys_price_type', 'sys_plan_type', 'oa_templete_id'],
  373. data() {
  374. return {
  375. loading: true,
  376. // 导入参数
  377. upload: {
  378. // 是否显示弹出层(导入)
  379. open: false,
  380. // 弹出层标题(导入)
  381. title: "数据导入",
  382. // 是否禁用上传
  383. isUploading: false,
  384. // 是否更新已经存在的用户数据
  385. updateSupport: 1,
  386. // 设置上传的请求头部
  387. headers: { Authorization: "Bearer " + getToken() },
  388. // 上传的地址
  389. url: process.env.VUE_APP_BASE_API + "/pu/demand/import"
  390. },
  391. // 模板下载参数
  392. download: {
  393. open: false,
  394. planType: 'ZJH',
  395. customer: '',
  396. warehouse: '',
  397. warehouseId: '',
  398. cargoSpace: '',
  399. category: ''
  400. },
  401. mBcustomer: [],
  402. mBwarehouse: [],
  403. mBcargoSpace: [],
  404. classOptions: [],
  405. // 下拉收起配置
  406. expanded: false,
  407. // 页面配置
  408. isList: true,
  409. // 页面状态
  410. page: '',
  411. queryParams: {
  412. code: this.$route.query.billCode,
  413. customer: '',
  414. isCustomerSpecified: '',
  415. demandPersonal: '',
  416. source: '',
  417. planType: '',
  418. billType: '',
  419. demandDept: '',
  420. demandDate: '',
  421. remark: '',
  422. createTimeString: '',
  423. materialCode: '',
  424. status: '',
  425. additionalSupplier: '',
  426. pageNum: 1,
  427. pageSize: 50
  428. },
  429. referCondition: {
  430. type: '',
  431. isPage: true,
  432. title: ''
  433. },
  434. options: [{
  435. value: 'Y', label: '是',
  436. }, {
  437. value: 'N', label: '否'
  438. }],
  439. customerOptions: [],
  440. personOptions: [],
  441. deptOptions: [],
  442. supplierOptions: [],
  443. tableList: [],
  444. total: 0,
  445. rowDetail: {},
  446. disable: false,
  447. ids: [],
  448. TableColumns: [
  449. { item: { key: "code", title: "需求单号", width: 150 }, attr: {} },
  450. { item: { key: "demandDate", title: "需求日期", width: 150 }, attr: {} },
  451. { item: { key: "createTime", title: "制单日期", width: 150 }, attr: {} },
  452. { item: { key: "planType", title: "需求计划", width: 150 }, attr: { is: "el-dict-tag", dictName: "sys_plan_type" } },
  453. { item: { key: "approverFinishTime", title: "审批结束日期", width: 150 }, attr: {} },
  454. { item: { key: "status", title: "单据状态", width: 150 }, attr: { is: "el-dict-tag", dictName: "sys_status" } },
  455. { item: { key: "billType", title: "业务类型", width: 150 }, attr: { is: "el-dict-tag", dictName: "sys_business" } },
  456. { item: { key: "demandPersonalName", title: "需求人员", width: 150 }, attr: {} },
  457. { item: { key: "customerName", title: "需求客户", width: 150 }, attr: {} },
  458. { item: { key: "demandDeptName", title: "需求部门", width: 150 }, attr: {} },
  459. { item: { key: "source", title: "单据来源", width: 150 }, attr: { is: "el-dict-tag", dictName: "sys_bill_source" } },
  460. { item: { key: "approveUser", title: "当前审批人", width: 150 }, attr: {} },
  461. { item: { key: "remark", title: "备注", width: 150 }, attr: {} },
  462. ].map(({ item, attr }) => ({
  463. attr,
  464. item: {
  465. ...item,
  466. sortabled: true,
  467. fixedabled: true,
  468. filterabled: true,
  469. hiddenabled: true,
  470. },
  471. })),
  472. setDemand: {
  473. open: false,
  474. gridData: []
  475. }
  476. }
  477. },
  478. created() {
  479. this.getList(this.queryParams)
  480. },
  481. methods: {
  482. // 格式化表格内容
  483. formatterPlanType(row) {
  484. switch(row.planType){
  485. case 'ZJH':
  486. return '周计划'
  487. case 'YJH':
  488. return '月计划'
  489. case 'JJXQ':
  490. return '紧急计划'
  491. }
  492. },
  493. formatterStatus(row) {
  494. switch(row.status){
  495. case '0':
  496. return '未提交'
  497. case '1':
  498. return '审批中'
  499. case '2':
  500. return '已完成'
  501. case '3':
  502. return '已驳回'
  503. case '9':
  504. return '已回退'
  505. }
  506. },
  507. formatterBillType(row) {
  508. switch (row.billType) {
  509. case 'ZQBH':
  510. return '周期备货'
  511. case 'FXXQ':
  512. return '分销需求'
  513. case 'TSXQ':
  514. return '特殊采购需求'
  515. case 'BDXQ':
  516. return '补单需求'
  517. case 'JJXQ':
  518. return '紧急需求单'
  519. case 'XPXQ':
  520. return '新品需求'
  521. case 'HZBM':
  522. return '合作部门需求'
  523. case 'DZBH':
  524. return '大宗备货'
  525. case 'XZCG':
  526. return '行政类采购'
  527. }
  528. },
  529. formatterSource(row) {
  530. switch (row.source) {
  531. case '1':
  532. return '手工导入'
  533. case '2':
  534. return '按客户计算'
  535. case '3':
  536. return '按仓库计算'
  537. case '4':
  538. return '手工新增'
  539. }
  540. },
  541. searchList() {
  542. this.getList(this.queryParams)
  543. },
  544. resetList() {
  545. this.queryParams = {
  546. code: '',
  547. customer: '',
  548. isCustomerSpecified: '',
  549. demandPersonal: '',
  550. source: '',
  551. planType: '',
  552. billType: '',
  553. demandDept: '',
  554. demandDate: '',
  555. remark: '',
  556. createTimeString: '',
  557. materialCode: '',
  558. status: '',
  559. additionalSupplier: '',
  560. pageNum: 1,
  561. pageSize: 50
  562. }
  563. this.getList(this.queryParams)
  564. },
  565. getList(params){
  566. getDemandList(params).then(res => {
  567. if (res.code === 200) {
  568. this.tableList = res.rows
  569. this.total = res.total
  570. }
  571. }).then(() => {
  572. this.loading = false
  573. }).catch(err => {
  574. this.loading = false
  575. })
  576. },
  577. handleSelectionChange(selection) {
  578. console.log('选中', selection)
  579. this.ids = selection.map(item => item.id)
  580. console.log('选中数组', this.ids.join())
  581. },
  582. mbDownload() {
  583. this.$modal.loading("正在下载模板,请稍后...");
  584. downLoadDemand(this.download).then(res => {
  585. this.$modal.closeLoading();
  586. const blob = new Blob([res], {
  587. type: "application/vnd.ms-excel;charset=UTF-8",
  588. });// 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
  589. const downloadElement = document.createElement("a"); //创建a标签
  590. const href = window.URL.createObjectURL(blob); // 创建下载的链接
  591. // var temp = res.headers["content-disposition"];
  592. // var fileName = decodeURIComponent(temp.split("filename=")[1]); // 中文需要转码 (前端乱码)
  593. // var name = fileName.split(";")[0]; //切割成文件名
  594. downloadElement.href = href; //下载地址
  595. downloadElement.download = '采购需求单模板'+ this.parseTime(new Date().getTime()) + ".xlsx"; // 下载后文件名
  596. document.body.appendChild(downloadElement);
  597. downloadElement.click(); // 点击下载
  598. document.body.removeChild(downloadElement); // 下载完成移除元素
  599. window.URL.revokeObjectURL(href); // 释放blob对象
  600. this.download.open = false
  601. }).catch(err => {
  602. this.$modal.closeLoading();
  603. })
  604. },
  605. // 关闭模板下载弹窗清空参数
  606. clearDownload() {
  607. // 模板下载参数
  608. this.download = {
  609. open: false,
  610. planType: 'ZJH',
  611. customer: '',
  612. warehouse: '',
  613. warehouseId: '',
  614. cargoSpace: '',
  615. category: ''
  616. }
  617. },
  618. handleCommand(command) {
  619. // alert(command)
  620. if(command == '模板下载') {
  621. this.download.open = true
  622. }
  623. if (command == '数据导入') {
  624. this.upload.title = "用户导入"
  625. this.upload.open = true
  626. }
  627. },
  628. // 文件上传中处理
  629. handleFileUploadProgress(event, file, fileList) {
  630. this.upload.isUploading = true;
  631. this.$modal.loading("正在导入数据,请稍后...");
  632. },
  633. // 文件上传成功处理
  634. handleFileSuccess(response, file, fileList) {
  635. this.$modal.closeLoading();
  636. this.upload.open = false;
  637. this.upload.isUploading = false;
  638. this.$refs.upload.clearFiles();
  639. this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
  640. this.getList(this.queryParams);
  641. },
  642. errorFile(err) {
  643. this.$modal.closeLoading();
  644. this.$modal.notifyError("文件已变动,请重新上传");
  645. },
  646. // 提交上传文件
  647. submitFileForm() {
  648. this.$refs.upload.submit();
  649. },
  650. handleExport(command) {
  651. if(command == '选中导出') {
  652. if (this.ids.length == 0) {
  653. this.$modal.notifyWarning("请选中至少一条数据");
  654. } else {
  655. this.$modal.loading("正在导出数据,请稍后...");
  656. let param = {all: false, ids: this.ids}
  657. exportDemand(param).then(res => {
  658. this.$modal.closeLoading();
  659. const blob = new Blob([res], {
  660. type: "application/vnd.ms-excel;charset=UTF-8",
  661. });// 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
  662. const downloadElement = document.createElement("a"); //创建a标签
  663. const href = window.URL.createObjectURL(blob); // 创建下载的链接
  664. // var temp = res.headers["content-disposition"];
  665. // var fileName = decodeURIComponent(temp.split("filename=")[1]); // 中文需要转码 (前端乱码)
  666. // var name = fileName.split(";")[0]; //切割成文件名
  667. downloadElement.href = href; //下载地址
  668. downloadElement.download = '采购需求单选中导出' + this.parseTime(new Date().getTime()) + ".xlsx"; // 下载后文件名
  669. document.body.appendChild(downloadElement);
  670. downloadElement.click(); // 点击下载
  671. document.body.removeChild(downloadElement); // 下载完成移除元素
  672. window.URL.revokeObjectURL(href); // 释放blob对象
  673. }).catch(err => {
  674. this.$modal.closeLoading();
  675. })
  676. }
  677. } else {
  678. this.$modal.loading("正在导出数据,请稍后...");
  679. let param2 = {all: true}
  680. exportDemand(param2).then(res => {
  681. this.$modal.closeLoading();
  682. const blob = new Blob([res], {
  683. type: "application/vnd.ms-excel;charset=UTF-8",
  684. });// 创建一个类文件对象:Blob对象表示一个不可变的、原始数据的类文件对象
  685. const downloadElement = document.createElement("a"); //创建a标签
  686. const href = window.URL.createObjectURL(blob); // 创建下载的链接
  687. // var temp = res.headers["content-disposition"];
  688. // var fileName = decodeURIComponent(temp.split("filename=")[1]); // 中文需要转码 (前端乱码)
  689. // var name = fileName.split(";")[0]; //切割成文件名
  690. downloadElement.href = href; //下载地址
  691. downloadElement.download = '采购需求单全部导出' + this.parseTime(new Date().getTime()) + ".xlsx";
  692. document.body.appendChild(downloadElement);
  693. downloadElement.click(); // 点击下载
  694. document.body.removeChild(downloadElement); // 下载完成移除元素
  695. window.URL.revokeObjectURL(href); // 释放blob对象
  696. }).catch(err => {
  697. this.$modal.closeLoading();
  698. })
  699. }
  700. },
  701. addDivision() {
  702. this.isList = false
  703. this.page = 'add'
  704. this.disable = false
  705. },
  706. check(row) {
  707. this.isList = false
  708. this.page = 'check'
  709. this.rowDetail = row
  710. this.disable = true
  711. },
  712. doubleClick(row) {
  713. this.isList = false
  714. this.page = 'check'
  715. this.rowDetail = row
  716. this.disable = true
  717. },
  718. // 表格选中数据
  719. rowSelect(row) {
  720. this.$refs.tables.toggleRowSelection([{row: row}]);
  721. },
  722. edit(row) {
  723. this.isList = false
  724. this.page = 'edit'
  725. this.rowDetail = row
  726. this.disable = false
  727. },
  728. commit(row) {
  729. console.log('row', row)
  730. this.$modal.loading("提交中...");
  731. submitDemand(row).then(res => {
  732. if (res.code === 200) {
  733. this.$modal.notifySuccess("提交成功");
  734. this.$modal.closeLoading();
  735. this.getList(this.queryParams)
  736. }
  737. if (res.code === 233) {
  738. this.$modal.confirm(res.msg).then(function() {
  739. // 确认
  740. }).then(() => {
  741. confirmSubmit(row).then(res => {
  742. if (res.code === 200) {
  743. this.$modal.notifySuccess("提交成功");
  744. this.$modal.closeLoading();
  745. this.getList(this.queryParams)
  746. }
  747. }).catch(err => {
  748. this.$modal.closeLoading();
  749. })
  750. // 取消
  751. }).catch(() => {
  752. this.$modal.closeLoading();
  753. })
  754. this.$modal.closeLoading();
  755. }
  756. }).catch(err => {
  757. this.$modal.closeLoading();
  758. })
  759. },
  760. // 流程收回
  761. reback(row) {
  762. this.$modal.loading("收回中...");
  763. let params = {
  764. billCode: row.code,
  765. fdId: row.flowId,
  766. fdTemplateId: this.dict.type.oa_templete_id.find(item => {
  767. return item.label == "采购需求单"
  768. }).value,
  769. billMaker: row.createBy
  770. }
  771. rebacktWork(params).then(res => {
  772. if (res.code === 200) {
  773. this.$modal.notifySuccess("收回成功");
  774. this.$modal.closeLoading();
  775. this.getList(this.queryParams)
  776. }
  777. }).catch(err => {
  778. this.$modal.closeLoading();
  779. })
  780. },
  781. // 行内删除
  782. deleteids(row) {
  783. console.log('row', row)
  784. this.$modal.confirm('确定删除选择数据?').then(() => {
  785. delDemand(row.id).then(res => {
  786. if (res.code === 200) {
  787. this.$modal.notifySuccess("删除成功");
  788. this.getList(this.queryParams)
  789. }
  790. })
  791. }).catch(() => {})
  792. },
  793. // 批量删除按钮
  794. delItems() {
  795. if(this.ids.length == 0) {
  796. this.$modal.notifyWarning("请选中至少一条数据");
  797. } else {
  798. let param = this.ids.join()
  799. this.$modal.confirm('确认删除选中数据?').then(() => {
  800. delDemand(param).then(res => {
  801. if (res.code === 200) {
  802. this.$modal.notifySuccess("删除成功");
  803. this.getList(this.queryParams)
  804. }
  805. })
  806. }).catch(() => {})
  807. }
  808. },
  809. handleSizeChange(val) {
  810. console.log(`每页 ${val} 条`);
  811. this.queryParams.pageSize = val
  812. this.getList(this.queryParams)
  813. },
  814. handleCurrentChange(val) {
  815. console.log(`当前页: ${val}`);
  816. this.queryParams.pageNum = val
  817. this.getList(this.queryParams)
  818. },
  819. drop() {
  820. this.expanded = !this.expanded
  821. },
  822. // 搜索区参照选择
  823. chooseOrg(type, isPage, title, stordocId) {
  824. this.referCondition.type = type
  825. this.referCondition.isPage = isPage
  826. this.referCondition.title = title
  827. this.referCondition.stordocId = stordocId
  828. this.$refs.refer.init(this.referCondition)
  829. },
  830. selectionsToInput(selection) {
  831. // 搜索区选择客户
  832. if (this.referCondition.type == 'CUSTOMER_PARAM' && this.referCondition.title == '需求客户') {
  833. this.customerOptions = selection
  834. this.queryParams.customer = selection[0].id
  835. }
  836. // 模板内选择客户
  837. if (this.referCondition.type == 'CUSTOMER_PARAM' && this.referCondition.title == '选择客户') {
  838. this.mBcustomer = selection
  839. this.download.customer = selection[0].code
  840. }
  841. // 模板内选择仓库
  842. if (this.referCondition.type == 'WAREHOUSE_PARAM' && this.referCondition.title == '选择仓库') {
  843. this.mBwarehouse = selection
  844. this.download.warehouse = selection[0].code
  845. this.download.warehouseId = selection[0].id
  846. }
  847. // 模板内选择货位
  848. if (this.referCondition.type == 'ALLOCATION_PARAM' && this.referCondition.title == '选择货位') {
  849. this.mBcargoSpace = selection
  850. this.download.cargoSpace = selection[0].code
  851. }
  852. if (this.referCondition.type == 'CONTACTS_PARAM') {
  853. this.personOptions = selection
  854. this.queryParams.demandPersonal = selection[0].code
  855. }
  856. if (this.referCondition.type == 'DEPT_PARAM') {
  857. this.deptOptions = selection
  858. this.queryParams.demandDept = selection[0].id
  859. }
  860. if (this.referCondition.type == 'SUPPLIER_PARAM') {
  861. this.supplierOptions = selection
  862. this.queryParams.additionalSupplier = selection[0].id
  863. }
  864. },
  865. mbHuowei(type, isPage, title, stordocId) {
  866. this.referCondition.type = type
  867. this.referCondition.isPage = isPage
  868. this.referCondition.title = title
  869. if(stordocId) {
  870. this.referCondition.stordocId = stordocId
  871. this.$refs.refer.init(this.referCondition)
  872. } else {
  873. this.$modal.notifyWarning("请先选择仓库")
  874. }
  875. },
  876. cleanMb() {
  877. this.download.warehouse = ''
  878. this.download.warehouseId = ''
  879. },
  880. // 搜索区树形选择
  881. chooseTreeRefer(type, isPage, title) {
  882. this.referCondition.type = type
  883. this.referCondition.isPage = isPage
  884. this.referCondition.title = title
  885. this.$refs.tree.init(this.referCondition)
  886. },
  887. selectionsToInput2(selection) {
  888. this.classOptions.push(selection)
  889. this.download.category = selection.code
  890. },
  891. // 需求窗口期配置
  892. demandWindow() {
  893. this.setDemand.open = true
  894. this.$nextTick(() => {
  895. getDemandWindowList().then(res => {
  896. if (res.code === 200) {
  897. this.setDemand.gridData = res.rows
  898. }
  899. })
  900. })
  901. },
  902. saveDemand() {
  903. let params = this.setDemand.gridData
  904. saveDemandWindow(params).then(res => {
  905. if (res.code === 200) {
  906. this.$modal.notifySuccess("保存成功");
  907. this.setDemand.open = false
  908. }
  909. })
  910. },
  911. changeDeadline(row) {
  912. row.delFlag = '2'
  913. },
  914. closeDemand() {}
  915. }
  916. }
  917. </script>
  918. <style lang="scss" scoped>
  919. #PurchaseDemandList {
  920. padding: 12px;
  921. box-sizing: border-box;
  922. overflow-y: scroll;
  923. }
  924. .btn_grooup {
  925. margin-bottom: 10px;
  926. display: flex;
  927. justify-content: flex-end;
  928. }
  929. .lines {
  930. margin-top: 0;
  931. }
  932. .el-pagination {
  933. margin-top: 10px;
  934. text-align: right;
  935. }
  936. ::v-deep .el-table__row > td {
  937. border-right: none;
  938. }
  939. ::v-deep .el-card .el-form-item {
  940. margin-bottom: 10px;
  941. }
  942. </style>
  943. <style>
  944. .exporttable {
  945. border: solid 1px #c0c0c0;
  946. }
  947. .el-table .el-table__header-wrapper th {
  948. font-size: 14px;
  949. }
  950. </style>