SpareStoreTotal.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464
  1. <template>
  2. <a-card :bordered="false">
  3. <div class="table-page-search-wrapper">
  4. <a-form layout="inline">
  5. <a-row :gutter="48">
  6. <a-col :md="8" :sm="24">
  7. <a-form-item label="关键字">
  8. <a-input v-model="queryParam.keyword" placeholder="请输入名称/编码" />
  9. </a-form-item>
  10. </a-col>
  11. <a-col :md="8" :sm="24">
  12. <a-form-item label="品牌">
  13. <a-input v-model="queryParam.brand" placeholder="模糊查询" />
  14. </a-form-item>
  15. </a-col>
  16. <a-col :md="8" :sm="24">
  17. <a-form-item label="类型">
  18. <a-tree-select style="width: 100%" :dropdownStyle="{ maxHeight: '400px', overflow: 'auto' }"
  19. :treeData="spareTypeTreeData" :treeNodeFilterProp="'title'" :showSearch="true"
  20. v-model="queryParam.typeId" placeholder="请选择">
  21. </a-tree-select>
  22. </a-form-item>
  23. </a-col>
  24. <a-col :md="8" :sm="24">
  25. <a-form-item label="规格型号">
  26. <a-input v-model="queryParam.ggxh" placeholder="模糊查询" />
  27. </a-form-item>
  28. </a-col>
  29. <a-col :md="8" :sm="24">
  30. <a-form-item label="原厂编号">
  31. <a-input v-model="queryParam.initNo" placeholder="模糊查询" />
  32. </a-form-item>
  33. </a-col>
  34. <a-col :md="8" :sm="24">
  35. <a-form-item label="生产商">
  36. <a-input v-model="queryParam.producerName" placeholder="名称模糊查询" />
  37. </a-form-item>
  38. </a-col>
  39. <a-col :md="8" :sm="24">
  40. <a-form-item label="供应商">
  41. <a-input v-model="queryParam.supplierName" placeholder="名称模糊查询" />
  42. </a-form-item>
  43. </a-col>
  44. <a-col :md="8" :sm="24">
  45. <a-form-item label="等级">
  46. <a-select v-model="queryParam.level" placeholder="请选择">
  47. <a-select-option v-for="(label, value) in levelMap" :key="value" :label="label"
  48. :value="parseInt(value)">{{ label }}
  49. </a-select-option>
  50. </a-select>
  51. </a-form-item>
  52. </a-col>
  53. <a-col :md="6" :sm="24">
  54. <a-form-item label="用途">
  55. <a-select v-model="queryParam.yt" placeholder="请选择">
  56. <a-select-option v-for="(label, value) in ytMap" :key="value" :label="label" :value="parseInt(value)">{{
  57. label }}
  58. </a-select-option>
  59. </a-select>
  60. </a-form-item>
  61. </a-col>
  62. <!-- <a-col :md="6" :sm="24">
  63. <a-form-item label="是否专用">
  64. <a-select v-model="queryParam.isSpecial" placeholder="请选择">
  65. <a-select-option
  66. v-for="(label,value) in specialMap"
  67. :key="value"
  68. :label="label"
  69. :value="parseInt(value)">{{ label }}
  70. </a-select-option>
  71. </a-select>
  72. </a-form-item>
  73. </a-col>-->
  74. <!-- <a-col :md="6" :sm="24">
  75. <a-form-item label="关联设备">
  76. <a-input v-model="queryParam.model" placeholder="新号/旧号/名称/规格"/>
  77. </a-form-item>
  78. </a-col>-->
  79. <a-col :md="6 || 24" :sm="24">
  80. <span class="table-page-search-submitButtons">
  81. <a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
  82. <a-button style="margin-left: 8px" @click="resetSearchForm">重置</a-button>
  83. <!-- <a-button style="margin-left: 8px" @click="searchTypeNull">空类型</a-button> -->
  84. </span>
  85. </a-col>
  86. </a-row>
  87. </a-form>
  88. </div>
  89. <div class="table-operator">
  90. <!--<a-button v-if="$auth('store-spare-stores-add')" type="primary" icon="plus" @click="$refs.baseModal.base()">新增</a-button>-->
  91. <a-button style="margin-left: 8px" v-if="$auth('store-spare-stores-export')" type="primary" icon="download"
  92. @click="doExport">导出</a-button>
  93. </div>
  94. <s-table ref="table" size="default" rowKey="id" :columns="columns" :data="loadData" :alert="options.alert"
  95. :scroll="{ x: 1500, y: BaseTool.Constant.scrollY }" :rowSelection="options.rowSelection" showPagination="auto">
  96. <span slot="action" slot-scope="record">
  97. <template>
  98. <a v-if="record.warnStatus != 1" @click="handleUpdateStatus(record, 1)">待处理</a>
  99. <a-divider type="vertical" />
  100. <a v-if="record.warnStatus != 2" @click="handleUpdateStatus(record, 2)">询价中</a>
  101. <a-divider type="vertical" />
  102. <a v-if="record.warnStatus != 3" @click="handleUpdateStatus(record, 3)">采购中</a>
  103. <a-divider type="vertical" />
  104. <a v-if="record.warnStatus != 0" @click="handleUpdateStatus(record, 0)">正常</a>
  105. </template>
  106. </span>
  107. <span slot="status" slot-scope="text">
  108. <badge :status="DictCache.COLOR.SPARE_WARN_STATUS[text]" :text="warnStatusMap[text]" />
  109. </span>
  110. </s-table>
  111. <base-form ref="baseModal" @ok="handleOk" />
  112. <detail ref="detailModal" />
  113. </a-card>
  114. </template>
  115. <script>
  116. import { STable, Ellipsis } from '@/components'
  117. import BaseForm from './modules/BaseForm'
  118. import Detail from './modules/Detail'
  119. import { fetchSpareTypeTree } from '@/api/sqarepartmanage/sparetype'
  120. import { getSparePartInfoPage, updateSparePartInfoWarnStatus, exportSparePartInfo } from '@/api/sqarepartmanage/sparepartinfo'
  121. import { queryDept, getDeptsAllByParentId } from '@/api/upms/dept'
  122. export default {
  123. name: 'SpareStoreTotal',
  124. components: {
  125. STable,
  126. Ellipsis,
  127. BaseForm,
  128. Detail
  129. },
  130. props: {
  131. filter: {
  132. type: Number,
  133. default: -1
  134. },
  135. warnStatusList: {
  136. type: Array,
  137. default: null
  138. },
  139. forecastStatusList: {
  140. type: Array,
  141. default: null
  142. }
  143. },
  144. data() {
  145. return {
  146. companyList: {},
  147. projectList: {},
  148. warnStatusMap: {},
  149. ytMap: {},
  150. specialMap: {},
  151. levelMap: {},
  152. spareTypeTreeData: [],
  153. // 查询参数
  154. queryParam: {
  155. filter: this.filter,
  156. warnStatusList: this.warnStatusList,
  157. forecastStatusList: this.forecastStatusList
  158. },
  159. // 表头
  160. columns: [
  161. {
  162. title: '序号',
  163. width: '100px',
  164. dataIndex: 'index',
  165. align: 'center',
  166. ellipsis: true,
  167. checked: true,
  168. customRender: (text, record, index) => {
  169. return `${(this.$refs.table.localPagination.current - 1) * this.$refs.table.localPagination.pageSize + index + 1}`
  170. }
  171. },
  172. {
  173. title: '备件编码',
  174. align: 'center',
  175. ellipsis: true,
  176. width: '150px',
  177. checked: true,
  178. dataIndex: 'no'
  179. },
  180. {
  181. title: '品牌',
  182. width: '150px',
  183. align: 'center',
  184. ellipsis: true,
  185. checked: true,
  186. dataIndex: 'brand'
  187. },
  188. {
  189. title: '备件名称',
  190. align: 'center',
  191. ellipsis: true,
  192. width: '150px',
  193. checked: true,
  194. dataIndex: 'name'
  195. },
  196. {
  197. title: '当前库存',
  198. align: 'center',
  199. ellipsis: true,
  200. width: '120px',
  201. checked: true,
  202. dataIndex: 'currentStock',
  203. customRender: (text, record, index) => {
  204. if (text == null) {
  205. return 0
  206. } else {
  207. return text
  208. }
  209. }
  210. },
  211. /* 隐藏保养预耗库存列
  212. {
  213. title: '保养预耗库存',
  214. width: '120px',
  215. align: 'center',
  216. ellipsis: true,
  217. checked: true,
  218. dataIndex: 'planCheckNum',
  219. customRender: (text, record, index) => {
  220. if (text == null) {
  221. return 0
  222. } else {
  223. return text
  224. }
  225. }
  226. },
  227. */
  228. {
  229. title: '最低库存',
  230. align: 'center',
  231. ellipsis: true,
  232. width: '120px',
  233. checked: true,
  234. dataIndex: 'minStock'
  235. },
  236. {
  237. title: '单位',
  238. width: '100px',
  239. align: 'center',
  240. ellipsis: true,
  241. checked: true,
  242. dataIndex: 'unit'
  243. },
  244. {
  245. title: '规格型号',
  246. align: 'center',
  247. ellipsis: true,
  248. width: '150px',
  249. checked: true,
  250. dataIndex: 'ggxh'
  251. },
  252. {
  253. title: '库位',
  254. width: '150px',
  255. align: 'center',
  256. ellipsis: true,
  257. checked: true,
  258. dataIndex: 'storeName'
  259. },
  260. {
  261. title: '最高库存',
  262. align: 'center',
  263. ellipsis: true,
  264. width: '120px',
  265. checked: true,
  266. dataIndex: 'maxStock'
  267. },
  268. {
  269. title: '等级',
  270. align: 'center',
  271. ellipsis: true,
  272. checked: true,
  273. width: '100px',
  274. dataIndex: 'level',
  275. customRender: (text, record, index) => {
  276. return this.BaseTool.Object.getField(this.levelMap, text)
  277. }
  278. },
  279. {
  280. title: '备件价值',
  281. align: 'center',
  282. ellipsis: true,
  283. width: '120px',
  284. checked: true,
  285. dataIndex: 'price'
  286. },
  287. {
  288. title: '备件类别',
  289. align: 'center',
  290. ellipsis: true,
  291. dataIndex: 'typeName',
  292. checked: true,
  293. width: '150px'
  294. },
  295. {
  296. title: '生产商',
  297. align: 'center',
  298. ellipsis: true,
  299. checked: true,
  300. width: '150px',
  301. dataIndex: 'producerId',
  302. customRender: (text, record, index) => {
  303. return record.producerName
  304. }
  305. },
  306. {
  307. title: '用途',
  308. checked: true,
  309. align: 'center',
  310. ellipsis: true,
  311. width: '150px',
  312. dataIndex: 'yt',
  313. customRender: (text, record, index) => {
  314. return this.BaseTool.Object.getField(this.ytMap, text)
  315. }
  316. },
  317. /* {
  318. title: '关联设备号',
  319. checked: true,
  320. width: '150px',
  321. dataIndex: 'sbNo'
  322. },*/
  323. {
  324. title: '备注',
  325. checked: true,
  326. align: 'center',
  327. ellipsis: true,
  328. width: '150px',
  329. dataIndex: 'remark'
  330. }
  331. /*{
  332. title: '状态',
  333. checked: true,
  334. fixed: 'right',
  335. dataIndex: 'warnStatus',
  336. scopedSlots: { customRender: 'status' }
  337. },
  338. {
  339. title: '操作',
  340. checked: true,
  341. key: 'action',
  342. fixed: 'right',
  343. width: '200px',
  344. align: 'center',
  345. scopedSlots: { customRender: 'action' }
  346. }*/
  347. ],
  348. // 下拉框map
  349. delFlagMap: {},
  350. // 加载数据方法 必须为 Promise 对象
  351. loadData: parameter => {
  352. parameter = {
  353. ...parameter,
  354. ...this.queryParam,
  355. dataScope: {
  356. }
  357. }
  358. return getSparePartInfoPage(Object.assign(parameter, this.queryParam))
  359. .then(res => {
  360. return res.data
  361. })
  362. },
  363. selectedRowKeys: [],
  364. selectedRows: [],
  365. options: {
  366. alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
  367. rowSelection: {
  368. selectedRowKeys: this.selectedRowKeys,
  369. onChange: this.onSelectChange
  370. }
  371. },
  372. optionAlertShow: false
  373. }
  374. },
  375. created() {
  376. // 下拉框map
  377. this.warnStatusMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SPARE_WARN_STATUS)
  378. this.ytMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SPARE_USE_TYPE)
  379. this.specialMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.YES_NO)
  380. this.levelMap = this.DictCache.getLabelByValueMapByType(this.DictCache.TYPE.SPARE_PART_INFO_LEVEL)
  381. this.tableOption()
  382. queryDept({ nature: this.DictCache.VALUE.SYS_DEPT_NATURE.FEN_GONG_SI }).then(res => {
  383. this.companyList = res.data
  384. })
  385. fetchSpareTypeTree({}).then(res => {
  386. this.spareTypeTreeData = res.data
  387. })
  388. },
  389. methods: {
  390. handleCompanyChange(value) {
  391. getDeptsAllByParentId({ deptId: value, nature: this.DictCache.VALUE.SYS_DEPT_NATURE.XIANG_MU_BU }).then(res => {
  392. this.projectList = res.data
  393. })
  394. },
  395. tableOption() {
  396. if (!this.optionAlertShow) {
  397. this.options = {
  398. alert: { show: true, clear: () => { this.selectedRowKeys = [] } },
  399. rowSelection: {
  400. selectedRowKeys: this.selectedRowKeys,
  401. onChange: this.onSelectChange,
  402. getCheckboxProps: record => ({
  403. props: {
  404. disabled: false,
  405. name: record.id
  406. }
  407. })
  408. }
  409. }
  410. this.optionAlertShow = true
  411. } else {
  412. this.options = {
  413. alert: false,
  414. rowSelection: null
  415. }
  416. this.optionAlertShow = false
  417. }
  418. },
  419. handleUpdateStatus(record, warnStatus) {
  420. const parameter = {}
  421. parameter.id = record.id
  422. parameter.warnStatus = warnStatus
  423. parameter.type = 1
  424. updateSparePartInfoWarnStatus(parameter)
  425. .then(() => {
  426. this.handleOk()
  427. }).catch(() => {
  428. this.confirmLoading = false
  429. })
  430. },
  431. handleOk() {
  432. this.$refs.table.refresh()
  433. },
  434. onSelectChange(selectedRowKeys, selectedRows) {
  435. this.selectedRowKeys = selectedRowKeys
  436. this.selectedRows = selectedRows
  437. },
  438. resetSearchForm() {
  439. this.queryParam = {
  440. filter: this.filter,
  441. warnStatusList: this.warnStatusList,
  442. forecastStatusList: this.forecastStatusList
  443. }
  444. this.$refs.table.refresh(true)
  445. },
  446. doExport() {
  447. const parameter = {
  448. ...this.queryParam
  449. }
  450. exportSparePartInfo(parameter).then(file => {
  451. this.BaseTool.UPLOAD.downLoadExportExcel(file)
  452. })
  453. },
  454. handleEnter() {
  455. this.$refs.table.refresh(true)
  456. }
  457. }
  458. }
  459. </script>