index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. <template>
  2. <view class="container">
  3. <page-title>年度计划查询</page-title>
  4. <view class="cards-list">
  5. <view class="card only-card">
  6. <!-- 年度 -->
  7. <view class="card-item first-card-item" @click="yearShowChoose()">
  8. <view class="card-item-name">年度</view>
  9. <view class="card-item-description">
  10. <view v-if="pageForm.year">{{pageForm.year}}</view>
  11. <view v-else class="remind-text">请选择年度</view>
  12. <u-icon name="arrow-right" color="#343437" size="16" customStyle="margin-left:10rpx"></u-icon>
  13. </view>
  14. </view>
  15. <!-- 项目类型 -->
  16. <view class="card-item" @click="xmlxShowChoose()">
  17. <view class="card-item-name">项目类型</view>
  18. <view class="card-item-description">
  19. <view v-if="pageForm.xmlx">{{pageForm.xmlx}}</view>
  20. <view v-else class="remind-text">请选择类型</view>
  21. <u-icon name="arrow-right" color="#343437" size="16" customStyle="margin-left:10rpx"></u-icon>
  22. </view>
  23. </view>
  24. <!-- 项目性质 -->
  25. <view class="card-item" @click="xmxzShowChoose()">
  26. <view class="card-item-name">项目性质</view>
  27. <view class="card-item-description">
  28. <view v-if="pageForm.xmxz">{{pageForm.xmxz}}</view>
  29. <view v-else class="remind-text">请选择性质</view>
  30. <u-icon name="arrow-right" color="#343437" size="16" customStyle="margin-left:10rpx"></u-icon>
  31. </view>
  32. </view>
  33. <!-- 行业分类 -->
  34. <view class="card-item" @click="hyflShowChoose()">
  35. <view class="card-item-name">行业分类</view>
  36. <view class="card-item-description">
  37. <view v-if="pageForm.hyfl">{{pageForm.hyfl}}</view>
  38. <view v-else class="remind-text">请选择分类</view>
  39. <u-icon name="arrow-right" color="#343437" size="16" customStyle="margin-left:10rpx"></u-icon>
  40. </view>
  41. </view>
  42. <!-- 建设地点 -->
  43. <view class="card-item" @click="jsddShowChoose()">
  44. <view class="card-item-name">建设地点</view>
  45. <view class="card-item-description">
  46. <view v-if="pageForm.jsdd">{{pageForm.jsdd}}</view>
  47. <view v-else class="remind-text">请选择地点</view>
  48. <u-icon name="arrow-right" color="#343437" size="16" customStyle="margin-left:10rpx"></u-icon>
  49. </view>
  50. </view>
  51. <!-- 申报单位 -->
  52. <view class="card-item">
  53. <view class="card-item-name">申报单位</view>
  54. <input v-model="pageForm.unitName" class="card-item-input" placeholder="请填写申报单位"
  55. placeholder-style="color: #D8D8D8" maxlength="20" />
  56. </view>
  57. <!-- 金额范围 -->
  58. <view class="card-item">
  59. <view class="card-item-name " style="min-width: 256rpx;">金额范围(万元)</view>
  60. <view class="card-item-range">
  61. <input v-model="pageForm.startAmt" class="card-item-input center-input" placeholder="最小值"
  62. placeholder-style="color: #D8D8D8" maxlength="20" type="number" />
  63. ~
  64. <input v-model="pageForm.endAmt" class="card-item-input center-input" placeholder="最大值"
  65. placeholder-style="color: #D8D8D8" maxlength="20" type="number" />
  66. </view>
  67. </view>
  68. <!-- 录入状态 -->
  69. <view class="card-item" @click="statusShowChoose()">
  70. <view class="card-item-name">录入状态</view>
  71. <view class="card-item-description">
  72. <view v-if="pageForm.status">{{pageForm.status}}</view>
  73. <view v-else class="remind-text">请选择状态</view>
  74. <u-icon name="arrow-right" color="#343437" size="16" customStyle="margin-left:10rpx"></u-icon>
  75. </view>
  76. </view>
  77. <!-- 锁定状态 -->
  78. <view class="card-item" @click="isLockNameShowChoose()">
  79. <view class="card-item-name">锁定状态</view>
  80. <view class="card-item-description">
  81. <view v-if="pageForm.isLockName">{{pageForm.isLockName}}</view>
  82. <view v-else class="remind-text">请选择状态</view>
  83. <u-icon name="arrow-right" color="#343437" size="16" customStyle="margin-left:10rpx"></u-icon>
  84. </view>
  85. </view>
  86. <!-- 项目名称 -->
  87. <view class="card-item">
  88. <view class="card-item-name">项目名称</view>
  89. <input v-model="pageForm.subName" class="card-item-input" placeholder="请填写项目名称"
  90. placeholder-style="color: #D8D8D8" maxlength="20" />
  91. </view>
  92. </view>
  93. <view class="confirm-btn" @click="confirmParams()">查询</view>
  94. </view>
  95. <!-- 年度选择 -->
  96. <u-picker :show="yearShow" :defaultIndex="defaultIndex" :columns="yearColumns" @confirm="yearClose"
  97. @cancel="yearClose" @close="yearClose" closeOnClickOverlay></u-picker>
  98. <!-- 项目类型选择 -->
  99. <u-picker :show="xmlxShow" :columns="xmlxColumns" @confirm="xmlxClose" @cancel="xmlxClose" @close="xmlxClose"
  100. closeOnClickOverlay></u-picker>
  101. <!-- 项目性质选择 -->
  102. <u-picker :show="xmxzShow" :columns="xmxzColumns" @confirm="xmxzClose" @cancel="xmxzClose" @close="xmxzClose"
  103. closeOnClickOverlay></u-picker>
  104. <!-- 行业分类选择 -->
  105. <u-picker :show="hyflShow" :columns="hyflColumns" @confirm="hyflClose" @cancel="hyflClose" @close="hyflClose"
  106. closeOnClickOverlay></u-picker>
  107. <!-- 建设地点选择 -->
  108. <u-picker :show="jsddShow" :columns="jsddColumns" @confirm="jsddClose" @cancel="jsddClose" @close="jsddClose"
  109. closeOnClickOverlay></u-picker>
  110. <!-- 录入状态选择 -->
  111. <u-picker :show="statusShow" :columns="statusColumns" @confirm="statusClose" @cancel="statusClose"
  112. @close="statusClose" closeOnClickOverlay></u-picker>
  113. <!-- 锁定状态选择 -->
  114. <u-picker :show="isLockNameShow" :columns="isLockNameColumns" @confirm="isLockNameClose" @cancel="isLockNameClose"
  115. @close="isLockNameClose" closeOnClickOverlay></u-picker>
  116. </view>
  117. </template>
  118. <script setup>
  119. import {
  120. ref
  121. } from 'vue'
  122. import {
  123. onLoad
  124. } from "@dcloudio/uni-app"
  125. import {
  126. getYearlyCondition
  127. } from "@/api/work/weeklyAndMonthly.js"
  128. function getCondition() {
  129. getYearlyCondition().then(res => {
  130. // 项目类型
  131. xmlxOrginal = res.data?.XMLX
  132. let xmlxTemp = res.data?.XMLX.map(item => item.title)
  133. xmlxTemp.unshift('请选择')
  134. xmlxColumns.value.push(xmlxTemp)
  135. // 项目性质
  136. xmxzOrginal = res.data?.JSXZ
  137. let xmxzTemp = res.data?.JSXZ.map(item => item.title)
  138. xmxzTemp.unshift('请选择')
  139. xmxzColumns.value.push(xmxzTemp)
  140. // 行业分类
  141. hyflOrginal = res.data?.HYFL
  142. let hyflTemp = res.data?.HYFL.map(item => item.title)
  143. hyflTemp.unshift('请选择')
  144. hyflColumns.value.push(hyflTemp)
  145. // 建设地点
  146. jsddOrginal = res.data?.JSDD
  147. let jsddTemp = res.data?.JSDD.map(item => item.title)
  148. jsddTemp.unshift('请选择')
  149. jsddColumns.value.push(jsddTemp)
  150. })
  151. }
  152. let pageForm = ref({
  153. year: null,
  154. xmlx: null,
  155. xmxz: null,
  156. hyfl: null,
  157. jsdd: null,
  158. unitName: null,
  159. minMoney: null,
  160. maxMoney: null,
  161. status: "所有",
  162. subName: null,
  163. // isLockName: null,
  164. isLock:null
  165. })
  166. // ====================================选择年
  167. let defaultIndex = ref([0])
  168. let yearShow = ref(false);
  169. let yearColumns = ref([
  170. ["2000", "2001", "2002", "2003", "2004", "2005", "2006", "2007", "2008", "2009", "2010", "2011", "2012", "2013",
  171. "2014", "2015", "2016", "2017", "2018", "2019", "2020", "2021", "2022", "2023", "2024", "2025", "2026",
  172. "2027", "2028", "2029", "2030", "2031", "2032", "2033"
  173. ]
  174. ])
  175. function yearShowChoose() {
  176. yearShow.value = true;
  177. }
  178. function yearClose(e) {
  179. if (e) pageForm.value.year = e.value[0];
  180. yearShow.value = false
  181. }
  182. // ====================================选择项目类型
  183. let xmlxOrginal = []
  184. let xmlxShow = ref(false)
  185. let xmlxColumns = ref([])
  186. function xmlxShowChoose() {
  187. xmlxShow.value = true;
  188. }
  189. function xmlxClose(e) {
  190. if (e) pageForm.value.xmlx = e.value[0];
  191. xmlxShow.value = false
  192. }
  193. // ====================================选择项目性质
  194. let xmxzOrginal = []
  195. let xmxzShow = ref(false)
  196. let xmxzColumns = ref([])
  197. function xmxzShowChoose() {
  198. xmxzShow.value = true;
  199. }
  200. function xmxzClose(e) {
  201. if (e) pageForm.value.xmxz = e.value[0];
  202. xmxzShow.value = false
  203. }
  204. // ====================================选择行业分类
  205. let hyflOrginal = []
  206. let hyflShow = ref(false)
  207. let hyflColumns = ref([])
  208. function hyflShowChoose() {
  209. hyflShow.value = true;
  210. }
  211. function hyflClose(e) {
  212. if (e) pageForm.value.hyfl = e.value[0];
  213. hyflShow.value = false
  214. }
  215. // ====================================选择建设地点
  216. let jsddOrginal = []
  217. let jsddShow = ref(false)
  218. let jsddColumns = ref([])
  219. function jsddShowChoose() {
  220. jsddShow.value = true;
  221. }
  222. function jsddClose(e) {
  223. if (e) pageForm.value.jsdd = e.value[0];
  224. jsddShow.value = false
  225. }
  226. // ====================================选择录入状态
  227. let statusShow = ref(false)
  228. let statusColumns = ref([
  229. ["所有", "已录入", "未录入"]
  230. ])
  231. function statusShowChoose() {
  232. statusShow.value = true;
  233. }
  234. function statusClose(e) {
  235. if (e) pageForm.value.status = e.value[0];
  236. statusShow.value = false
  237. }
  238. // ====================================选择锁定状态
  239. let isLockNameShow = ref(false)
  240. let isLockNameColumns = ref([
  241. ["所有", "正常", "锁定"]
  242. ])
  243. function isLockNameShowChoose() {
  244. isLockNameShow.value = true;
  245. }
  246. function isLockNameClose(e) {
  247. if (e) pageForm.value.isLockName = e.value[0];
  248. isLockNameShow.value = false
  249. }
  250. // 确认选择
  251. function confirmParams() {
  252. let sendParams = Object.assign({}, pageForm.value)
  253. sendParams.xmlx = findChooseId('xmlx', sendParams.xmlx)
  254. sendParams.xmxz = findChooseId('xmxz', sendParams.xmxz)
  255. sendParams.hyfl = findChooseId('hyfl', sendParams.hyfl)
  256. sendParams.jsdd = findChooseId('jsdd', sendParams.jsdd)
  257. let statusOrginal = {
  258. "所有": "0",
  259. "已录入": "1",
  260. "未录入": "2"
  261. }
  262. let isLockOrginal = {
  263. "所有": "",
  264. "正常": "0",
  265. "锁定": "1"
  266. }
  267. sendParams.status = statusOrginal[sendParams.status] ? statusOrginal[sendParams.status] : null
  268. sendParams.isLock = isLockOrginal[sendParams.isLockName] ? isLockOrginal[sendParams.isLockName] : null
  269. let url = "/pages/yearly/list/index?"
  270. for (let i in sendParams) {
  271. let item = null
  272. if (sendParams[i]) {
  273. item = `${i}=${sendParams[i]}&`
  274. } else {
  275. item = `${i}=&`
  276. }
  277. url = url += item
  278. }
  279. url = url.substr(0, url.length - 1);
  280. uni.navigateTo({
  281. url
  282. })
  283. }
  284. function findChooseId(list, value) {
  285. let defaultList = {
  286. xmlx: xmlxOrginal,
  287. xmxz: xmxzOrginal,
  288. hyfl: hyflOrginal,
  289. jsdd: jsddOrginal,
  290. }
  291. let item = defaultList[list].find(item => item.title === value)
  292. if (list === 'xmxz') return item ? item.code : null
  293. if (list === 'jsdd') return item ? item.code : null
  294. return item ? item.id : null
  295. }
  296. onLoad(() => {
  297. // 默认年
  298. let now = new Date()
  299. let nowYear = now.getFullYear()
  300. pageForm.value.year = nowYear
  301. defaultIndex.value = [Number(nowYear) - 2000]
  302. getCondition()
  303. })
  304. </script>
  305. <style lang="scss" scoped>
  306. </style>