list.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298
  1. <template>
  2. <view class="quick-task" style="padding-bottom: 150upx">
  3. <cu-custom class="home-custom" bgColor=".bg-sancolor"
  4. bgImage="https://ahwgh.oss-cn-hangzhou.aliyuncs.com/enterprise/6525f808df760.png" :isBack="true">
  5. <block slot="content">胶体金检测</block>
  6. </cu-custom>
  7. <!-- 搜索部分 -->
  8. <view class="search-Top"
  9. style="position: fixed;z-index: 999; width: 100%;box-shadow: 0 5px 10px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);">
  10. <view class="cu-bar search bg-white">
  11. <view class="search-form radius">
  12. <text class="cuIcon-search"></text>
  13. <input type="text" placeholder="输入企业名称搜索" confirm-type="search" v-model="enterprisesName" />
  14. <text class="cuIcon cuIcon-close endClass text-xxl text-bold" @tap="resetEnterprisesQuery"
  15. v-show="enterprisesName !== ''"></text>
  16. </view>
  17. <view class="action">
  18. <!-- 全部的按钮 -->
  19. <picker mode="multiSelector" :range="regionArray" @change="RegionChange" :value="regionIndex"
  20. @columnchange="columnchange">
  21. <view class="picker">
  22. {{queryXzq}}
  23. </view>
  24. </picker>
  25. <text class="cuIcon-triangledownfill"></text>
  26. </view>
  27. </view>
  28. <view class="cu-bar search bg-white">
  29. <view class="search-form radius">
  30. <text class="cuIcon-search"></text>
  31. <input type="text" placeholder="输入样本名称搜索" confirm-type="search" v-model="productName" />
  32. <text class="cuIcon cuIcon-close endClass text-xxl text-bold" @tap="resetProductQuery"
  33. v-show="productName !== ''"></text>
  34. </view>
  35. <view class="action">
  36. <!-- 全部的按钮 -->
  37. <button class="cu-btn bg-green shadow-blur" style="margin-right: 22px;" @tap="search">搜索</button>
  38. </view>
  39. </view>
  40. </view>
  41. <!-- 列表部分 -->
  42. <view class="padding-sm quick-list">
  43. <view class="cu-list menu margin-top taskDetail bg-white" v-for="(item, index) in listData" :key="index">
  44. <view class="cu-item">
  45. <view class="title text-black text-bold text-lg">
  46. <text class="cuIcon-titles text-green"></text>
  47. {{ item.jcxm }}
  48. </view>
  49. <view class="action">
  50. <view class="text-gray">
  51. {{ [1,2].includes(item.jcjg) ? '阴性' : '阳性' }}
  52. </view>
  53. </view>
  54. </view>
  55. <view class="content padding-sm detail solid-bottom">
  56. <view>检测编号:{{ item.jcbh }}</view>
  57. <view>检测站名称:{{ item.jczmc }}</view>
  58. <view>被检单位:{{ item.enterprisesName }}</view>
  59. <view>样本名称:{{ item.productName }}</view>
  60. <view>产品批次号:{{ item.batchId }}</view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="padding flex flex-direction padding-bottom-xl fixedFootBtn padding-top-xs">
  65. <button class="cu-btn bg-green lg margin-top-sm shadow-blur" type="" @tap="nextSetp">
  66. 新增检测
  67. </button>
  68. </view>
  69. </view>
  70. </template>
  71. <script>
  72. import {
  73. _sampleDetail
  74. } from "../sample-detail/sample-detail-model.js";
  75. export default {
  76. data() {
  77. return {
  78. listData: [],
  79. regionArray: [],
  80. regionIndex: [],
  81. xzqObjList: [],
  82. queryXzq:"全部",
  83. queryXzqdm: null,
  84. pageNum: 1,
  85. pageSize: 10,
  86. pageTotal: 1,
  87. unitId: '',
  88. enterprisesName: '',
  89. productName: '',
  90. inSearching: false,
  91. };
  92. },
  93. onLoad() {
  94. const { unitId } = uni.getStorageSync("userInfo");
  95. this.unitId = unitId;
  96. this.queryXzqdm = unitId;
  97. this.getList()
  98. this.initRange();
  99. },
  100. methods: {
  101. search() {
  102. this.pageNum = 1;
  103. this.getList()
  104. },
  105. resetEnterprisesQuery(){
  106. this.enterprisesName = "";
  107. },
  108. resetProductQuery() {
  109. this.productName = "";
  110. },
  111. getList() {
  112. this.inSearching = true
  113. _sampleDetail.getJTJList({
  114. xzqCode: this.queryXzqdm,
  115. enterprisesName: this.enterprisesName,
  116. productName: this.productName,
  117. pageNum: this.pageNum,
  118. pageSize: this.pageSize
  119. }, res => {
  120. const { records, total } = res.data
  121. if (this.pageNum === 1) {
  122. this.listData = records
  123. } else {
  124. this.listData = this.listData.concat(records)
  125. }
  126. this.pageTotal = total
  127. this.inSearching = false
  128. if (records.length > 0) {
  129. this.pageNum++
  130. }
  131. })
  132. },
  133. onReachBottom() {
  134. this.getList();
  135. },
  136. getSubXzqList(xzqdm) {
  137. return new Promise(resolve => {
  138. _sampleDetail.getSubXzqList(xzqdm, res => {
  139. resolve(res);
  140. });
  141. });
  142. },
  143. async initRange() {
  144. const {
  145. unitId,
  146. name
  147. } = uni.getStorageSync("userInfo");
  148. let role = uni.getStorageSync("role");
  149. let xzqdm;
  150. if (role == "f35551e4a06647dea5c2c43aaba22c2a") {
  151. xzqdm = unitId.substring(4, 13);
  152. }
  153. if (role == "a1cbf841b0514b47bbdd3f50c80b729f") {
  154. xzqdm = unitId
  155. }
  156. let level = 0;
  157. if (xzqdm.endsWith("0000000")) { //省
  158. level = 3;
  159. } else if (xzqdm.endsWith("00000")) { //市
  160. level = 2;
  161. } else if (xzqdm.endsWith("000")) { //县
  162. level = 1;
  163. }
  164. const xzqlist = await this.getSubXzqList(xzqdm);
  165. if (level !== 0) {
  166. xzqlist.unshift({
  167. xzqdm: "",
  168. xzqmc: "请选择"
  169. });
  170. this.regionArray.splice(0, this.regionArray.length, xzqlist.map(v => v.xzqmc));
  171. this.xzqObjList.splice(0, this.xzqObjList.length, xzqlist);
  172. this.regionIndex.splice(0, this.regionIndex.length, 0);
  173. for (let i = 0; i < level - 1; i++) {
  174. this.regionArray.push(["请选择"]);
  175. this.xzqObjList.push({
  176. xzqdm: "",
  177. xzqmc: "请选择"
  178. });
  179. this.regionIndex.push(0);
  180. }
  181. } else {
  182. xzqlist.unshift({
  183. xzqdm: unitId,
  184. xzqmc: name
  185. });
  186. this.regionArray.push([name]);
  187. this.xzqObjList.push({
  188. xzqdm: unitId,
  189. xzqmc: name
  190. });
  191. this.regionIndex.push(0);
  192. }
  193. },
  194. async columnchange(e) {
  195. const { column, value } = e.detail;
  196. const xzqdm = this.xzqObjList[column][value]["xzqdm"];
  197. if (xzqdm) {
  198. if (column <= this.regionIndex.length - 2) {
  199. const subList = await this.getSubXzqList(xzqdm);
  200. subList.unshift({
  201. xzqdm: "",
  202. xzqmc: "请选择"
  203. });
  204. this.xzqObjList.splice(column + 1, 1, subList); //逐级push-乡镇
  205. this.regionIndex.splice(column + 1, 1, 0);
  206. this.regionArray.splice(column + 1, 1, subList.map(v => v.xzqmc));
  207. for (let i = column + 2; i < this.regionIndex.length; i++) {
  208. this.xzqObjList.splice(i, 1, [{ xzqdm: "", xzqmc: "请选择" }]); //逐级push-乡镇
  209. this.regionIndex.splice(i, 1, 0);
  210. this.regionArray.splice(i, 1, ["请选择"]);
  211. }
  212. }
  213. } else {
  214. for (let i = column + 1; i < this.regionIndex.length; i++) {
  215. this.xzqObjList.splice(i, 1, [{ xzqdm: "", xzqmc: "请选择" }]); //逐级push-乡镇
  216. this.regionIndex.splice(i, 1, 0);
  217. this.regionArray.splice(i, 1, ["请选择"]);
  218. }
  219. }
  220. },
  221. RegionChange(e){
  222. this.regionIndex = e.detail.value;
  223. let xzqdm = "", xzqmc = [];
  224. for (let i = 0; i <= this.regionIndex.length - 1; i++) {
  225. if (this.regionArray[i][this.regionIndex[i]] !== "请选择") {
  226. xzqmc.push(this.regionArray[i][this.regionIndex[i]]);
  227. xzqdm = this.xzqObjList[i][this.regionIndex[i]].xzqdm;
  228. }
  229. }
  230. this.queryXzqdm = xzqdm || this.unitId;
  231. this.queryXzq = xzqmc.join("/") || '全部';
  232. this.pageNum = 1
  233. this.getList();//查询
  234. },
  235. nextSetp() {
  236. uni.navigateTo({
  237. url: "/pages/quick-task/form"
  238. });
  239. }
  240. }
  241. }
  242. </script>
  243. <style scoped>
  244. .quick-task {
  245. background: #fff;
  246. height: 100%;
  247. width: 100%;
  248. }
  249. .first-step {
  250. height: 100%;
  251. display: flex;
  252. flex-direction: column;
  253. justify-content: center;
  254. align-items: center;
  255. padding-top: 20vh;
  256. }
  257. .first-step button {
  258. width: 90%;
  259. margin-top: 20vh;
  260. }
  261. .first-step image {
  262. width: 60vw;
  263. margin-left: 10vw;
  264. }
  265. .quick-list {
  266. padding-top: 100px;
  267. padding-bottom: 100px;
  268. }
  269. .detail view {
  270. height: 1.8em;
  271. line-height: 1.8em !important;
  272. border: none;
  273. color: gray;
  274. }
  275. .taskDetail {
  276. /*border: 1rpx solid #8799a3;*/
  277. box-shadow: 0 0 25upx #aaa;
  278. border-radius: 10rpx;
  279. overflow: hidden;
  280. }
  281. </style>