listPage.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <!--申购-->
  2. <template>
  3. <div class="listPage">
  4. <div class="listPage-min" v-show="pageType == 1">
  5. <el-form :model="queryParamsData" class="form-box" ref="queryForm" :inline="true">
  6. <el-form-item label="关键字" prop="searchValue">
  7. <el-input
  8. style="width:210px;"
  9. maxLength="30"
  10. v-model="queryParamsData.searchValue"
  11. placeholder="化学品名/别名/CAS号"
  12. clearable
  13. size="small"
  14. />
  15. </el-form-item>
  16. <el-form-item label="化学品分类" prop="chemicalClassify">
  17. <el-select v-model="queryParamsData.chemicalClassify" clearable placeholder="请选择化学品分类" style="width:180px;">
  18. <el-option
  19. v-for="item in optionsListOne"
  20. :key="item.id"
  21. :label="item.classifyName"
  22. :value="item.id">
  23. </el-option>
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item label="属性" prop="classifyAttribute">
  27. <el-select v-model="queryParamsData.classifyAttribute" clearable placeholder="请选择属性" style="width:180px;">
  28. <el-option
  29. v-for="item in optionsListTwo"
  30. :key="item.dictValue"
  31. :label="item.dictLabel"
  32. :value="item.dictValue">
  33. </el-option>
  34. </el-select>
  35. </el-form-item>
  36. <el-form-item>
  37. <p class="inquire-button-one" @click="handleQuery" style="margin-right:10px;">查询</p>
  38. <p class="reset-button-one" @click="resetQuery">重置</p>
  39. </el-form-item>
  40. <el-form-item style="float: right;">
  41. <el-col :span="1.5">
  42. <p class="inquire-button-one"
  43. @click="goPage(2)"
  44. >确定</p>
  45. </el-col>
  46. </el-form-item>
  47. <el-form-item style="float: right;">
  48. <el-col :span="1.5">
  49. <p class="reset-button-one"
  50. @click="backPage"
  51. >返回</p>
  52. </el-col>
  53. </el-form-item>
  54. </el-form>
  55. <el-table border :data="tableList" ref="multipleTable" @selection-change="handleSelectionChange" :row-key="getRowKeys">
  56. <el-table-column type="selection" width="50" align="center" :reserve-selection="true"/>
  57. <el-table-column label="ID" align="center" prop="chemicalNum" show-overflow-tooltip/>
  58. <el-table-column label="化学品名" align="center" prop="chemicalName" show-overflow-tooltip/>
  59. <el-table-column label="CAS号" align="center" prop="casNum" show-overflow-tooltip/>
  60. <el-table-column label="分类" align="center" prop="classifyName" show-overflow-tooltip/>
  61. <el-table-column label="属性" align="center" prop="classifyAttribute" show-overflow-tooltip/>
  62. <el-table-column label="形态" align="center" prop="chemicalShapeInfo" show-overflow-tooltip/>
  63. <el-table-column label="纯度" align="center" prop="purity" show-overflow-tooltip/>
  64. </el-table>
  65. <pagination
  66. v-show="total>0"
  67. :total="total"
  68. :page-sizes="[20, 30, 40, 50]"
  69. :page.sync="queryParams.pageNum"
  70. :limit.sync="queryParams.pageSize"
  71. @pagination="getList"
  72. />
  73. </div>
  74. <add-page :addPagePropsData="addPagePropsData"
  75. :multipleTableList="multipleTableList"
  76. :editPropsData="editPropsData"
  77. v-if="pageType == 2"></add-page>
  78. </div>
  79. </template>
  80. <script>
  81. import { classifyList } from "@/api/medicUniversity-3_1/index";
  82. import { hxpChemicalList } from "@/api/studentApi/chemicalManagement/index";
  83. import addPage from "./addPage.vue"
  84. export default {
  85. name: "listPage",
  86. components: {
  87. addPage,
  88. },
  89. data(){
  90. return{
  91. // 遮罩层
  92. loading:false,
  93. //页面状态
  94. pageType:1,
  95. // 分类
  96. optionsListOne:[],
  97. // 属性
  98. optionsListTwo:[],
  99. // 创建时间
  100. dateRange:[],
  101. // 搜索数据
  102. queryParamsData:{
  103. pageNum:1,
  104. pageSize:20,
  105. },
  106. // 搜索实际发送数据
  107. queryParams:{
  108. pageNum:1,
  109. pageSize:20,
  110. },
  111. //数据数量
  112. total:0,
  113. //数据数组
  114. tableList:[],
  115. // 选中用户组
  116. userIds: [],
  117. // 非多个禁用
  118. multiple: true,
  119. //表格扩展选择器---需要在@selection-change绑定的方法内监控selection数组长度
  120. selectedNum:0,
  121. //新增页参数
  122. addPagePropsData:{},
  123. //勾选数据
  124. multipleTableList:[],
  125. //编辑参数
  126. editPropsData:{},
  127. }
  128. },
  129. created() {
  130. },
  131. mounted(){
  132. this.getDicts("hxp_classifyattribute").then(response => {
  133. this.optionsListTwo = response.data;
  134. })
  135. this.classifyList();
  136. this.getList();
  137. },
  138. methods: {
  139. //确定申购
  140. goPage(type,data){
  141. let self = this;
  142. if(type==1){
  143. this.pageType = 1;
  144. this.$set(this,'addPagePropsData',{});
  145. this.$set(this,'multipleTableList',[]);
  146. this.$refs.multipleTable.clearSelection()
  147. }else if(type == 2){
  148. if(!this.multipleTableList[0]){
  149. this.msgError("请勾选化学品")
  150. return
  151. }
  152. this.pageType = 2;
  153. }else if(type == 3){
  154. this.$set(this,'addPagePropsData',JSON.parse(JSON.stringify(data)));
  155. this.pageType = 1;
  156. }
  157. },
  158. //获取数据列表
  159. getList(){
  160. this.queryParamsData = JSON.parse(JSON.stringify(this.queryParams));
  161. hxpChemicalList(this.queryParamsData).then(response => {
  162. this.total = response.total;
  163. this.tableList = response.rows;
  164. });
  165. },
  166. //获取化学品分类列表
  167. classifyList(){
  168. classifyList().then(response => {
  169. this.optionsListOne = response.rows;
  170. });
  171. },
  172. /** 搜索按钮操作 */
  173. handleQuery() {
  174. this.queryParamsData.pageNum = 1;
  175. this.queryParamsData.pageSize = 20;
  176. this.queryParams = JSON.parse(JSON.stringify(this.queryParamsData));
  177. this.getList();
  178. },
  179. /** 重置按钮操作 */
  180. resetQuery() {
  181. this.$set(this,'queryParamsData',{});
  182. this.$set(this,'queryParams',{});
  183. this.handleQuery();
  184. },
  185. //返回
  186. backPage(){
  187. this.$parent.pageToggle(1);
  188. },
  189. // 多选框选中数据
  190. handleSelectionChange(selection) {
  191. this.selectedNum = selection.length;
  192. this.userIds = selection.map(item => item.id)
  193. this.$set(this,'multipleTableList',selection);
  194. this.multiple = !selection.length
  195. },
  196. /*===记录勾选数据===
  197. 需要再el-table 添加 :row-key="getRowKeys"
  198. 需要在selection 添加 :reserve-selection="true"
  199. */
  200. getRowKeys(row) {
  201. return row.id
  202. },
  203. }
  204. }
  205. </script>
  206. <style scoped lang="scss">
  207. .listPage{
  208. flex:1;
  209. display: flex;
  210. flex-direction: column;
  211. overflow: hidden;
  212. p{
  213. margin:0;
  214. padding:0;
  215. }
  216. .listPage-min{
  217. flex:1;
  218. display: flex;
  219. flex-direction: column;
  220. overflow: hidden;
  221. padding:20px;
  222. .button-box{
  223. display: flex;
  224. }
  225. }
  226. }
  227. </style>