quick-list.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334
  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="action">
  12. <!-- 全部的按钮 -->
  13. <picker mode="multiSelector" :range="regionArray" @change="RegionChange" :value="regionIndex"
  14. @columnchange="columnchange">
  15. <view class="picker">
  16. {{queryXzq}}
  17. </view>
  18. </picker>
  19. <text class="cuIcon-triangledownfill"></text>
  20. </view>
  21. <view class="search-form radius">
  22. <text class="cuIcon-search"></text>
  23. <input type="text" placeholder="输入企业名称搜索" confirm-type="search" v-model="enterprisesName" />
  24. <text class="cuIcon cuIcon-close endClass text-xxl text-bold" @tap="resetEnterprisesQuery"
  25. v-show="enterprisesName !== ''"></text>
  26. </view>
  27. <view class="action">
  28. <!-- 全部的按钮 -->
  29. <button class="cu-btn bg-green shadow-blur" @tap="search">搜索</button>
  30. </view>
  31. </view>
  32. <view class="cu-form-group">
  33. <view class="title">
  34. <text class="padding-right-sm"><text class="cuIcon-filter"></text>筛选更多</text>
  35. <view class="cu-tag bg-orange light">测试</view></view>
  36. <view>
  37. <view class="text-bold text-df">
  38. <text class="cuIcon-close"></text>
  39. 重置</view>
  40. </view>
  41. <!-- <view class="search-form radius">
  42. <text class="cuIcon-search"></text>
  43. <input type="text" placeholder="输入样本名称搜索" confirm-type="search" v-model="productName" />
  44. <text class="cuIcon cuIcon-close endClass text-xxl text-bold" @tap="resetProductQuery"
  45. v-show="productName !== ''"></text>
  46. </view>-->
  47. </view>
  48. </view>
  49. <!-- 列表部分 -->
  50. <view class="padding-sm quick-list">
  51. <view class="cu-list menu margin-top-sm taskDetail bg-white" v-for="(item, index) in listData" :key="index">
  52. <view class="cu-item">
  53. <view class="title text-black text-bold text-lg">
  54. <text class="cuIcon-titles text-green"></text>
  55. {{ item.jcxm }}
  56. </view>
  57. <view class="action">
  58. <view class="radius text-lg text-bold" :class="item.jcjg ? 'text-green':'text-red'">
  59. {{ item.jcjg ? '合格' : '不合格' }}
  60. </view>
  61. </view>
  62. </view>
  63. <view class="content padding-sm detail solid-bottom">
  64. <view>检测任务编号:{{ item.rwbh }}</view>
  65. <view>检测站名称:{{ item.jczmc }}</view>
  66. <view>被检企业名称:{{ item.enterprisesName }}</view>
  67. <view>样本名称:{{ item.ybmc }}</view>
  68. <view>产品批次号:{{ item.productBatchId }}</view>
  69. <view>检测时间:{{ item.jcTime }}</view>
  70. <view>检测值:{{ item.jcz }}{{ item.jczUnit }}</view>
  71. <view>检测类型:{{ typeMap[item.type] }}</view>
  72. <view>创建时间:{{ item.createTime }}</view>
  73. </view>
  74. </view>
  75. </view>
  76. <view class="cu-modal" :class="modalName==='filterDlg'?'show':''">
  77. <view class="cu-dialog">
  78. <!-- <view class="cu-bar bg-white justify-end">
  79. <view class="content" style="width: 100%">添加抽样单</view>
  80. <view class="action" @tap="hideModal">
  81. <text class="cuIcon-close text-red"></text>
  82. </view>
  83. </view>-->
  84. <view class="padding-lr-lg bg-white padding-bottom">
  85. <view class="cu-list menu">
  86. <view class="cu-form-group ">
  87. <view class="title">样品名称</view>
  88. <input name="input" v-model="productName" placeholder="请输入抽样人员1">
  89. </view>
  90. <view class="cu-form-group ">
  91. <view class="title">检测结果</view>
  92. <input name="input" v-model="options.samplingPeopleSecond" placeholder="请输入抽样人员2">
  93. </view>
  94. </view>
  95. <view class="padding flex flex-direction">
  96. <button class="cu-btn bg-blue lg" @tap="submitSampleSheet">提交</button>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. </template>
  103. <script>
  104. import {
  105. _sampleDetail
  106. } from "../sample-detail/sample-detail-model.js";
  107. export default {
  108. data() {
  109. return {
  110. listData: [],
  111. regionArray: [],
  112. regionIndex: [],
  113. xzqObjList: [],
  114. queryXzq:"全部",
  115. queryXzqdm: null,
  116. modalName: null,
  117. pageNum: 1,
  118. pageSize: 10,
  119. pageTotal: 1,
  120. unitId: '',
  121. enterprisesName: '',
  122. productName: '',
  123. inSearching: false,
  124. typeMap: {
  125. 1: '农残',
  126. 2: '畜禽',
  127. 3: '水产'
  128. }
  129. };
  130. },
  131. onLoad() {
  132. const { unitId } = uni.getStorageSync("userInfo");
  133. this.unitId = unitId;
  134. this.queryXzqdm = unitId;
  135. this.getList()
  136. this.initRange();
  137. },
  138. methods: {
  139. search() {
  140. this.pageNum = 1;
  141. this.getList()
  142. },
  143. resetEnterprisesQuery(){
  144. this.enterprisesName = "";
  145. },
  146. resetProductQuery() {
  147. this.productName = "";
  148. },
  149. getList() {
  150. this.inSearching = true
  151. _sampleDetail.getQuickList({
  152. xzqCode: this.queryXzqdm.substring(4, 13),
  153. enterprisesName: this.enterprisesName,
  154. ybmc: this.productName,
  155. pageNum: this.pageNum,
  156. pageSize: this.pageSize
  157. }, res => {
  158. const { records, total } = res.data
  159. if (this.pageNum === 1) {
  160. this.listData = records
  161. } else {
  162. this.listData = this.listData.concat(records)
  163. }
  164. this.pageTotal = total
  165. this.inSearching = false
  166. if (records.length > 0) {
  167. this.pageNum++
  168. }
  169. })
  170. },
  171. onReachBottom() {
  172. this.getList();
  173. },
  174. getSubXzqList(xzqdm) {
  175. return new Promise(resolve => {
  176. _sampleDetail.getSubXzqList(xzqdm, res => {
  177. resolve(res);
  178. });
  179. });
  180. },
  181. async initRange() {
  182. const {
  183. unitId,
  184. name
  185. } = uni.getStorageSync("userInfo");
  186. let role = uni.getStorageSync("role");
  187. let xzqdm;
  188. if (role == "f35551e4a06647dea5c2c43aaba22c2a") {
  189. xzqdm = unitId.substring(4, 13);
  190. }
  191. if (role == "a1cbf841b0514b47bbdd3f50c80b729f") {
  192. xzqdm = unitId
  193. }
  194. let level = 0;
  195. if (xzqdm.endsWith("0000000")) { //省
  196. level = 3;
  197. } else if (xzqdm.endsWith("00000")) { //市
  198. level = 2;
  199. } else if (xzqdm.endsWith("000")) { //县
  200. level = 1;
  201. }
  202. const xzqlist = await this.getSubXzqList(xzqdm);
  203. if (level !== 0) {
  204. xzqlist.unshift({
  205. xzqdm: "",
  206. xzqmc: "请选择"
  207. });
  208. this.regionArray.splice(0, this.regionArray.length, xzqlist.map(v => v.xzqmc));
  209. this.xzqObjList.splice(0, this.xzqObjList.length, xzqlist);
  210. this.regionIndex.splice(0, this.regionIndex.length, 0);
  211. for (let i = 0; i < level - 1; i++) {
  212. this.regionArray.push(["请选择"]);
  213. this.xzqObjList.push({
  214. xzqdm: "",
  215. xzqmc: "请选择"
  216. });
  217. this.regionIndex.push(0);
  218. }
  219. } else {
  220. xzqlist.unshift({
  221. xzqdm: unitId,
  222. xzqmc: name
  223. });
  224. this.regionArray.push([name]);
  225. this.xzqObjList.push({
  226. xzqdm: unitId,
  227. xzqmc: name
  228. });
  229. this.regionIndex.push(0);
  230. }
  231. },
  232. async columnchange(e) {
  233. const { column, value } = e.detail;
  234. const xzqdm = this.xzqObjList[column][value]["xzqdm"];
  235. if (xzqdm) {
  236. if (column <= this.regionIndex.length - 2) {
  237. const subList = await this.getSubXzqList(xzqdm);
  238. subList.unshift({
  239. xzqdm: "",
  240. xzqmc: "请选择"
  241. });
  242. this.xzqObjList.splice(column + 1, 1, subList); //逐级push-乡镇
  243. this.regionIndex.splice(column + 1, 1, 0);
  244. this.regionArray.splice(column + 1, 1, subList.map(v => v.xzqmc));
  245. for (let i = column + 2; i < this.regionIndex.length; i++) {
  246. this.xzqObjList.splice(i, 1, [{ xzqdm: "", xzqmc: "请选择" }]); //逐级push-乡镇
  247. this.regionIndex.splice(i, 1, 0);
  248. this.regionArray.splice(i, 1, ["请选择"]);
  249. }
  250. }
  251. } else {
  252. for (let i = column + 1; i < this.regionIndex.length; i++) {
  253. this.xzqObjList.splice(i, 1, [{ xzqdm: "", xzqmc: "请选择" }]); //逐级push-乡镇
  254. this.regionIndex.splice(i, 1, 0);
  255. this.regionArray.splice(i, 1, ["请选择"]);
  256. }
  257. }
  258. },
  259. RegionChange(e){
  260. this.regionIndex = e.detail.value;
  261. let xzqdm = "", xzqmc = [];
  262. for (let i = 0; i <= this.regionIndex.length - 1; i++) {
  263. if (this.regionArray[i][this.regionIndex[i]] !== "请选择") {
  264. xzqmc.push(this.regionArray[i][this.regionIndex[i]]);
  265. xzqdm = this.xzqObjList[i][this.regionIndex[i]].xzqdm;
  266. }
  267. }
  268. this.queryXzqdm = xzqdm || this.unitId;
  269. this.queryXzq = xzqmc.join("/") || '全部';
  270. this.pageNum = 1
  271. this.getList();//查询
  272. },
  273. nextSetp() {
  274. uni.navigateTo({
  275. url: "/pages/quick-task/form"
  276. });
  277. }
  278. }
  279. }
  280. </script>
  281. <style scoped>
  282. .quick-task {
  283. background: #fff;
  284. height: 100%;
  285. width: 100%;
  286. }
  287. .first-step {
  288. height: 100%;
  289. display: flex;
  290. flex-direction: column;
  291. justify-content: center;
  292. align-items: center;
  293. padding-top: 20vh;
  294. }
  295. .first-step button {
  296. width: 90%;
  297. margin-top: 20vh;
  298. }
  299. .first-step image {
  300. width: 60vw;
  301. margin-left: 10vw;
  302. }
  303. .quick-list {
  304. padding-top: 100px;
  305. }
  306. .detail view {
  307. height: 1.8em;
  308. line-height: 1.8em !important;
  309. border: none;
  310. color: gray;
  311. }
  312. .taskDetail {
  313. /*border: 1rpx solid #8799a3;*/
  314. box-shadow: 0 0 25upx #aaa;
  315. border-radius: 10rpx;
  316. overflow: hidden;
  317. }
  318. </style>