index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360
  1. <!--库存明细-->
  2. <template>
  3. <div class="app-container InventoryDetails">
  4. <advanced-search :searchData="searchData"></advanced-search>
  5. <div class="InventoryDetails-min">
  6. <el-table border :data="tableList" @selection-change="handleSelectionChange" ref="multipleTable" :row-key="getRowKeys">
  7. <el-table-column type="selection" width="50" :reserve-selection="true" align="center"/>
  8. <el-table-column label="化学品编号" align="center" prop="joinNum" width="130"/>
  9. <el-table-column label="化学品名" align="center" prop="chemicalName" width="180"/>
  10. <el-table-column label="CAS号" align="center" prop="casNum" width="180"/>
  11. <el-table-column label="化学品柜" align="center" prop="cabinetName" width="200" show-overflow-tooltip/>
  12. <el-table-column label="化学品柜位置" align="center" prop="posi" width="300" show-overflow-tooltip/>
  13. <el-table-column label="分类" align="center" prop="classifyName" width="181"/>
  14. <el-table-column label="属性" align="center" prop="classifyAttribute" width="158" show-overflow-tooltip/>
  15. <el-table-column label="容量规格" align="center" prop="chemicalAmountUnit" width="121"/>
  16. <el-table-column label="容器规格" align="center" prop="tareUnit" width="121"/>
  17. <el-table-column label="标签类型" align="center" prop="labelType" width="121"/>
  18. <el-table-column label="标签编号" align="center" prop="tagCode" width="130"/>
  19. <el-table-column label="过期时间" align="center" prop="expirationTime" width="130"/>
  20. <el-table-column label="原始库存" align="center" prop="usages" width="120"/>
  21. <el-table-column label="实时库存" align="center" prop="outUsages" width="120"/>
  22. <el-table-column label="状态" align="center" prop="stockStatus" width="100"/>
  23. <el-table-column label="入库时间" align="center" prop="joinTime" width="183"/>
  24. <el-table-column label="出库时间" align="center" prop="outTime" width="183"/>
  25. </el-table>
  26. <div style="display: flex;height:32px;margin-top:15px;">
  27. <!--<p style="flex:4;"></p>-->
  28. <p style="text-align: left;margin:0;line-height:32px;margin-right:20px;font-size:14px;color:#999;">
  29. <i class="el-icon-warning" style="color:#0183FA;"></i>
  30. 已选择 {{selectedNum}} 项
  31. </p>
  32. <div style="flex:5;">
  33. <pagination :page-sizes="[20, 30, 40, 50]"
  34. v-show="total>0"
  35. :total="total"
  36. style="margin:0;"
  37. :page.sync="queryParams.pageNum"
  38. :limit.sync="queryParams.pageSize"
  39. @pagination="getList"
  40. />
  41. </div>
  42. </div>
  43. </div>
  44. </div>
  45. </template>
  46. <script>
  47. import { classifyList,getNoauthList,getListDetail } from "@/api/medicUniversity-3_1/index";
  48. import { listDepartments } from "@/api/system/dept";
  49. import advancedSearch from "@/components/ZDcomponents/advancedSearch.vue"
  50. export default {
  51. name: "InventoryDetails",
  52. components: {
  53. advancedSearch
  54. },
  55. data() {
  56. return {
  57. searchData:{
  58. buttonList:[//按钮数组没有则为空
  59. {
  60. type:"3", //按钮类型 1.按钮 2.导入 3.导出
  61. parameter:"export",//按钮字符用于返回方法时的判断
  62. hasPermi:['chemical:hxpStock:detailExport'] // 权限字段 如果没有则传空字符 hasPermi:"",
  63. },
  64. ],
  65. searchList:[//搜索数组
  66. {
  67. name:"关键字",//描述名称
  68. key:"searchValue",//键名 用于返回数据
  69. value:"",//内容 用于组件内绑定数据
  70. placeholder:"化学品名/别名/CAS号/编号/实验室",//输入提示
  71. level:"1",//1.普通搜索 2.高级搜索 普通搜索默认会在高级搜索时显示
  72. type:"1",//类型 1.input 2.select 3.TimePicker
  73. universal:'20',//通用参数 input时为最大长度 //TimePicker时可不传
  74. width:'260',//el-form-item 长度 可传可不传 不传时input/select默认180长度 TimePicker默认240长度
  75. },
  76. {
  77. name:"化学品分类",//描述名称
  78. key:"chemicalClassify",//键名 用于返回数据
  79. value:"",//内容 用于组件内绑定数据
  80. placeholder:"请选择化学品分类",//输入提示
  81. level:"2",//1.普通搜索 2.高级搜索 普通搜索默认会在高级搜索时显示
  82. type:"2",//类型 1.input 2.select 3.TimePicker
  83. universal:[],
  84. width:'175',//el-form-item 长度 可传可不传 不传时input/select默认180长度 TimePicker默认240长度
  85. },
  86. {
  87. name:"状态",//描述名称
  88. key:"status",//键名 用于返回数据
  89. value:"",//内容 用于组件内绑定数据
  90. placeholder:"请选择状态",//输入提示
  91. level:"1",//1.普通搜索 2.高级搜索 普通搜索默认会在高级搜索时显示
  92. type:"2",//类型 1.input 2.select 3.TimePicker
  93. universal:[ //通用参数 select时为列表数据 //TimePicker时可不传
  94. {label:"在库",value:"1"},{label:"用结出库",value:"2"},{label:"作废出库",value:"3"},
  95. ],
  96. width:'175',//el-form-item 长度 可传可不传 不传时input/select默认180长度 TimePicker默认240长度
  97. },
  98. {
  99. name:"化学品柜",//描述名称
  100. key:"cabinetId",//键名 用于返回数据
  101. value:"",//内容 用于组件内绑定数据
  102. placeholder:"请选择化学品柜",//输入提示
  103. level:"1",//1.普通搜索 2.高级搜索 普通搜索默认会在高级搜索时显示
  104. type:"2",//类型 1.input 2.select 3.TimePicker
  105. universal:[],
  106. width:'175',//el-form-item 长度 可传可不传 不传时input/select默认180长度 TimePicker默认240长度
  107. },
  108. {
  109. name:"属性",//描述名称
  110. key:"classifyAttribute",//键名 用于返回数据
  111. value:"",//内容 用于组件内绑定数据
  112. placeholder:"请选择属性",//输入提示
  113. level:"2",//1.普通搜索 2.高级搜索 普通搜索默认会在高级搜索时显示
  114. type:"2",//类型 1.input 2.select 3.TimePicker
  115. universal:[],
  116. width:'180',//el-form-item 长度 可传可不传 不传时input/select默认180长度 TimePicker默认240长度
  117. },
  118. {
  119. name:"标签类型",//描述名称
  120. key:"labelType",//键名 用于返回数据
  121. value:"",//内容 用于组件内绑定数据
  122. placeholder:"请选择标签类型",//输入提示
  123. level:"2",//1.普通搜索 2.高级搜索 普通搜索默认会在高级搜索时显示
  124. type:"2",//类型 1.input 2.select 3.TimePicker
  125. universal:[ //通用参数 select时为列表数据 //TimePicker时可不传
  126. {label:"RFID",value:"1"},{label:"二维码",value:"2"}
  127. ],
  128. width:'180',//el-form-item 长度 可传可不传 不传时input/select默认180长度 TimePicker默认240长度
  129. },
  130. {
  131. name:"学院",//描述名称
  132. key:"deptId",//键名 用于返回数据
  133. value:"",//内容 用于组件内绑定数据
  134. placeholder:"请选择学院",//输入提示
  135. level:"2",//1.普通搜索 2.高级搜索 普通搜索默认会在高级搜索时显示
  136. type:"2",//类型 1.input 2.select 3.TimePicker
  137. universal:[],
  138. labelWidth:'54px',//label-width宽度 可传可不传 不传时为默认宽度
  139. width:'180',//el-form-item 长度 可传可不传 不传时input/select默认180长度 TimePicker默认240长度
  140. },
  141. {
  142. name:"入库时间",//描述名称
  143. key:"timeOne",//键名 用于返回数据
  144. value:"",//内容 用于组件内绑定数据
  145. placeholder:"请选择入库时间",//输入提示
  146. level:"2",//1.普通搜索 2.高级搜索 普通搜索默认会在高级搜索时显示
  147. type:"3",//类型 1.input 2.select 3.TimePicker
  148. width:'260',//el-form-item 长度 可传可不传 不传时input/select默认180长度 TimePicker默认240长度
  149. },
  150. {
  151. name:"出库时间",//描述名称
  152. key:"timeTwo",//键名 用于返回数据
  153. value:"",//内容 用于组件内绑定数据
  154. placeholder:"请选择出库时间",//输入提示
  155. level:"2",//1.普通搜索 2.高级搜索 普通搜索默认会在高级搜索时显示
  156. type:"3",//类型 1.input 2.select 3.TimePicker
  157. width:'260',//el-form-item 长度 可传可不传 不传时input/select默认180长度 TimePicker默认240长度
  158. },
  159. ],
  160. },
  161. // 搜索实际发送数据
  162. queryParams:{
  163. pageNum:1,
  164. pageSize:20,
  165. },
  166. //数据数量
  167. total:0,
  168. //数据数组
  169. tableList:[],
  170. //表格扩展选择器---需要在@selection-change绑定的方法内监控selection数组长度
  171. selectedNum:0,
  172. // 选中数组
  173. ids: [],
  174. // 非单个禁用
  175. single: true,
  176. // 非多个禁用
  177. multiple: true,
  178. };
  179. },
  180. created() {
  181. },
  182. mounted(){
  183. this.getDicts("hxp_classifyattribute").then(response => {
  184. let list = [];
  185. for(let i=0;i<response.data.length;i++){
  186. let obj ={
  187. value:response.data[i].dictValue,
  188. label:response.data[i].dictLabel,
  189. }
  190. list.push(obj);
  191. }
  192. this.$set(this.searchData.searchList[4],'universal',list);
  193. })
  194. this.classifyList();
  195. this.listDepartments();
  196. this.getNoauthList();
  197. this.getList();
  198. },
  199. methods: {
  200. //获取化学品柜列表
  201. getNoauthList(){
  202. getNoauthList({}).then(response => {
  203. let list = [];
  204. for(let i=0;i<response.data.length;i++){
  205. let obj ={
  206. value:response.data[i].id,
  207. label:response.data[i].cabinetName,
  208. }
  209. list.push(obj);
  210. }
  211. this.$set(this.searchData.searchList[3],'universal',list);
  212. });
  213. },
  214. //获取学院列表
  215. listDepartments(){
  216. listDepartments().then(response => {
  217. let list = [];
  218. for(let i=0;i<response.data.length;i++){
  219. let obj ={
  220. value:response.data[i].deptId,
  221. label:response.data[i].deptName,
  222. }
  223. list.push(obj);
  224. }
  225. this.$set(this.searchData.searchList[6],'universal',list);
  226. });
  227. },
  228. //获取化学品分类列表
  229. classifyList(){
  230. classifyList().then(response => {
  231. let list = [];
  232. for(let i=0;i<response.rows.length;i++){
  233. let obj ={
  234. value:response.rows[i].id,
  235. label:response.rows[i].classifyName,
  236. }
  237. list.push(obj);
  238. }
  239. this.$set(this.searchData.searchList[1],'universal',list);
  240. });
  241. },
  242. getList(){
  243. getListDetail(this.queryParams).then(response => {
  244. this.total = response.total;
  245. this.tableList = response.rows;
  246. });
  247. },
  248. //父组件必要此方法用于接收参数
  249. searchClick(type,data){
  250. let self = this;
  251. if(type == 1){ //type 1.查询
  252. console.log(data);
  253. this.queryParams = JSON.parse(JSON.stringify(data));
  254. if(data.timeOne){
  255. this.queryParams.joinTimeBegin = data.timeOne[0];
  256. this.queryParams.joinTimeEnd = data.timeOne[1];
  257. delete this.queryParams.timeOne
  258. }else{
  259. delete this.queryParams.timeOne
  260. }
  261. if(data.timeTwo){
  262. this.queryParams.outTimeBegin = data.timeTwo[0];
  263. this.queryParams.outTimeEnd = data.timeTwo[1];
  264. delete this.queryParams.timeTwo
  265. }else{
  266. delete this.queryParams.timeTwo
  267. }
  268. this.queryParams.pageNum = 1;
  269. this.queryParams.pageSize = 10;
  270. this.getList();
  271. }else if(type == 2){ //type 1.重置
  272. this.queryParams = {
  273. pageNum : 1,
  274. pageSize:20,
  275. };
  276. this.getList();
  277. }else if(type == 'export'){ //type 其他 自定义按钮
  278. let currentDate = this.getCurrentTime()
  279. if(data == 1){
  280. //导出全部
  281. self.$confirm(`确认导出全部数据?`, "提示", {
  282. confirmButtonText: "确定",
  283. cancelButtonText: "取消",
  284. type: "warning"
  285. }).then(async () => {
  286. self.download('/chemical/hxpStock/exportDetail/', {...self.queryParams}, '库存明细-'+currentDate+'.xlsx')
  287. }).catch(() => {})
  288. }else if(data == 2){
  289. //导出选中
  290. if(self.ids.length>0) {
  291. self.$confirm(`确认导出选中数据?`, "提示", {
  292. confirmButtonText: "确定",
  293. cancelButtonText: "取消",
  294. type: "warning"
  295. }).then(async () => {
  296. let ids = self.ids.join(',');
  297. let obj = {
  298. ids :ids
  299. }
  300. self.download(`/chemical/hxpStock/exportDetail/`,obj, '库存明细-'+currentDate+'.xlsx')
  301. }).catch(() => {})
  302. }else {
  303. this.msgError('请选择要导出的数据')
  304. }
  305. }
  306. }
  307. },
  308. /** 当前时间 */
  309. getCurrentTime () {
  310. const yy = new Date().getFullYear()
  311. const mm = new Date().getMonth() + 1
  312. const dd = new Date().getDate()
  313. const hh = new Date().getHours()
  314. const mf = new Date().getMinutes() < 10 ? '0' + new Date().getMinutes() : new Date().getMinutes()
  315. const ss = new Date().getSeconds() < 10 ? '0' + new Date().getSeconds() : new Date().getSeconds()
  316. return yy + '-' + mm + '-' + dd
  317. },
  318. // 多选框选中数据
  319. handleSelectionChange(selection) {
  320. this.selectedNum = selection.length;
  321. this.ids = selection.map(item => item.id);
  322. this.single = selection.length != 1;
  323. this.multiple = !selection.length;
  324. },
  325. /*===记录勾选数据===
  326. 需要再el-table 添加 :row-key="getRowKeys"
  327. 需要在selection 添加 :reserve-selection="true"
  328. */
  329. getRowKeys(row) {
  330. return row.id
  331. },
  332. }
  333. }
  334. </script>
  335. <style scoped lang="scss">
  336. .InventoryDetails{
  337. flex:1;
  338. display: flex;
  339. flex-direction: column;
  340. overflow: hidden!important;
  341. padding-top:20px!important;
  342. p{
  343. margin:0;
  344. padding:0;
  345. }
  346. .InventoryDetails-min{
  347. flex:1;
  348. display: flex;
  349. flex-direction: column;
  350. overflow: hidden!important;
  351. padding:0 20px 20px!important;
  352. }
  353. }
  354. </style>