owner_serach.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374
  1. <template>
  2. <div class="flex flex-center padding white-bg ">
  3. <el-form v-model="form" class="lab mt-20 full-width" label-width="120px">
  4. <div class="flex">
  5. <div class="flex flex-col mr-15">
  6. <el-form-item class="full-width" label="项目名称">
  7. <el-input
  8. v-model="form.projectName"
  9. placeholder="输入项目关键字"
  10. prefix-icon="Search"
  11. />
  12. </el-form-item>
  13. <div class="flex flex-center">
  14. <el-form-item class="full-width" label="是否开工">
  15. <el-select
  16. v-model="form.isStart"
  17. style="width: 100%">
  18. <el-option
  19. v-for="item in start"
  20. :key="item.value"
  21. :label="item.label"
  22. :value="item.value"
  23. />
  24. </el-select>
  25. </el-form-item>
  26. <el-form-item class="full-width" label="是否入库">
  27. <el-select
  28. v-model="form.isStorage"
  29. style="width: 100%">
  30. <el-option
  31. v-for="item in storage"
  32. :key="item.value"
  33. :label="item.label"
  34. :value="item.value"
  35. />
  36. </el-select>
  37. </el-form-item>
  38. </div>
  39. </div>
  40. <div class="flex flex-col ml-20 mr-15">
  41. <!-- <el-form-item class="full-width" label="分类筛选">-->
  42. <!-- <el-select-->
  43. <!-- v-model="form.typeId"-->
  44. <!-- clearable-->
  45. <!-- placeholder="选择项目分类"-->
  46. <!-- style="width: 100%">-->
  47. <!-- <el-option-->
  48. <!-- v-for="item in typeList"-->
  49. <!-- :key="item.id"-->
  50. <!-- :label="item.name"-->
  51. <!-- :value="item.id"-->
  52. <!-- />-->
  53. <!-- </el-select>-->
  54. <!-- </el-form-item>-->
  55. <div class="flex flex-center ">
  56. <el-form-item class="full-width" label="省重点">
  57. <el-select
  58. v-model="form.isImportant"
  59. style="width: 100%">
  60. <el-option
  61. v-for="item in isimport"
  62. :key="item.value"
  63. :label="item.label"
  64. :value="item.value"
  65. />
  66. </el-select>
  67. </el-form-item>
  68. <el-form-item class="full-width" label="省集中开工">
  69. <el-select
  70. v-model="form.isFocusStart"
  71. style="width: 100%">
  72. <el-option
  73. v-for="item in isfocus"
  74. :key="item.value"
  75. :label="item.label"
  76. :value="item.value"
  77. />
  78. </el-select>
  79. </el-form-item>
  80. </div>
  81. <div class="flex flex-center flex-justify-between">
  82. <el-form-item class="full-width " label="总投资额">
  83. <el-select
  84. v-model="form.amount"
  85. @change="changeAmount"
  86. style="width: 100%"
  87. >
  88. <el-option
  89. v-for="item in totalAmount"
  90. :key="item.value"
  91. :label="item.name"
  92. :value="item.value"
  93. />
  94. </el-select>
  95. </el-form-item>
  96. <el-form-item class="full-width" label="机构选择">
  97. <div class="grey-9 pointer chose-box nowrap" @click="getOrg">
  98. 选择机构
  99. </div>
  100. </el-form-item>
  101. </div>
  102. <div class="flex flex-center flex-justify-end">
  103. </div>
  104. </div>
  105. <div class="flex flex-col flex-justify-between">
  106. <div></div>
  107. <div class="flex flex-align-center flex-justify-end ml-10" style="margin-bottom: 18px">
  108. <base-button class="pointer " icon="Delete" title="清空" type="0" width="130" @click="clear"/>
  109. <base-button class="pointer ml-20" width="130" @click="sure"/>
  110. </div>
  111. </div>
  112. </div>
  113. </el-form>
  114. <!----机构选择----->
  115. <el-dialog v-model='showOrg'
  116. append-to-body
  117. center
  118. title="机构选择"
  119. width="45%">
  120. <div class="flex flex-col">
  121. <el-input
  122. v-model="keyWords"
  123. clearable
  124. placeholder="机构快速搜索"
  125. prefix-icon="Search"
  126. @blur='change'
  127. />
  128. </div>
  129. <el-divider/>
  130. <div class="hide-scrollbar full-width" style="height: 20vh;overflow-x: scroll">
  131. <!-- <div v-if='attaches.length === 0' class='full-width flex flex-center '>-->
  132. <!-- <el-empty image-size='100'/>-->
  133. <!-- </div>-->
  134. <div class="flex flex-justify-between flex-center">
  135. <span class="bold font-15 grey ml-5 ">部门</span>
  136. </div>
  137. <div class="grid radius mt-15 padding" style="border: 1px solid #DDDFE6">
  138. <div v-for="(item,index) in deptList" :key='item.id' class="flex flex-center pointer padding"
  139. :class="item.search ? 'org-search' : item.checked ? 'org-s' : 'org'" @click='changeChecked(index)'>
  140. <div :class="item.checked ? 'dot-checked' : 'dot'"></div>
  141. <div class='ml-5 full-width' :class="item.checked || item.search ? 'white' : ''">{{ item.deptName }}</div>
  142. </div>
  143. </div>
  144. </div>
  145. <div class="flex flex-center mt-20 mb-5">
  146. <base-button title="重置" type="0" icon="Refresh"/>
  147. <base-button class="ml-20" title="确定" icon="Check" @click='orgCheck'/>
  148. </div>
  149. </el-dialog>
  150. </div>
  151. </template>
  152. <script>
  153. import baseButton from '../../../components/base-button.vue'
  154. import { useStore } from '@/store/user.js'
  155. export default {
  156. name: 'owner_serach',
  157. components: { baseButton },
  158. watch: {
  159. keyWords: {
  160. handler (val) {
  161. setTimeout(() => {
  162. this.change()
  163. }, 500)
  164. },
  165. immediate: true
  166. }
  167. },
  168. setup () {
  169. const user = useStore()
  170. return { user }
  171. },
  172. data () {
  173. return {
  174. deptList: [],
  175. form: {
  176. projectName: '', // 项目名称/关键字
  177. typeId: '', // 项目分类
  178. isStart: '', // 是否开工
  179. isStorage: '', // 是否入库
  180. amount: '',
  181. isImportant: '', // 是否省重点
  182. isFocusStart: '', // 是否集中开工
  183. deptIds: '', // 机构id,多选
  184. type: true
  185. },
  186. totalAmount: [
  187. {
  188. name: '5000万以下',
  189. value: '0,4999' // 0 max 1 min
  190. },
  191. {
  192. name: '5000-9999万',
  193. value: '5000,9999'
  194. },
  195. {
  196. name: '1 亿以上',
  197. value: '10000,-'
  198. }
  199. ],
  200. start: [
  201. {
  202. label: '否',
  203. value: 0
  204. },
  205. {
  206. label: '是',
  207. value: 1
  208. }
  209. ],
  210. storage: [
  211. {
  212. label: '否',
  213. value: 0
  214. },
  215. {
  216. label: '是',
  217. value: 1
  218. }
  219. ],
  220. isimport: [
  221. {
  222. label: '否',
  223. value: 0
  224. },
  225. {
  226. label: '是',
  227. value: 1
  228. }
  229. ],
  230. isfocus: [
  231. {
  232. label: '否',
  233. value: 0
  234. },
  235. {
  236. label: '是',
  237. value: 1
  238. }
  239. ],
  240. typeList: [],
  241. showOrg: false,
  242. keyWords: '',
  243. checked: false
  244. }
  245. },
  246. created () {
  247. this.getTypeList()
  248. },
  249. methods: {
  250. getTypeList () {
  251. this.$api.project.typeList().then(res => {
  252. this.typeList = res.data.records
  253. })
  254. },
  255. sure () {
  256. this.form.type = true
  257. console.log(this.form)
  258. this.$bus.emit('serach', this.form)
  259. },
  260. clear () {
  261. this.form.projectName = ''
  262. this.form.typeId = ''
  263. this.form.isStorage = ''
  264. this.form.isStart = ''
  265. this.form.amount = ''
  266. this.form.isFocusStart = ''
  267. this.form.isImportant = ''
  268. this.form.deptIds = ''
  269. this.form.type = false
  270. this.$bus.emit('serach', this.form)
  271. },
  272. changeAmount () {
  273. const tmps = this.form.amount.split(',')
  274. console.log(tmps)
  275. this.form.totalAmountMin = tmps[0] === '-' ? '' : tmps[0]
  276. this.form.totalAmountMax = tmps[1] === '-' ? '' : tmps[1]
  277. },
  278. getOrg () {
  279. const parentId = [0, 2].includes(this.user.info.viewStage) ? this.user.info.parentDeptId : this.user.info.deptId
  280. this.$api.system.getDeptLazy({ parentId }).then(res => {
  281. if (res.code === 200) {
  282. this.showOrg = true
  283. this.deptList = res.data.map(e => {
  284. e.checked = false
  285. return e
  286. })
  287. } else {
  288. this.$message.error(res.msg)
  289. }
  290. })
  291. },
  292. changeChecked (index) {
  293. this.deptList[index].checked = !this.deptList[index].checked
  294. },
  295. orgCheck () {
  296. const checked = this.deptList.filter(sub => sub.checked)
  297. this.form.deptIds = checked.map(sub => sub.id).join(',')
  298. this.showOrg = false
  299. },
  300. change () {
  301. if (this.keyWords.length === 0) {
  302. this.deptList.forEach(sub => sub.search = false)
  303. return
  304. }
  305. const tmp = this.deptList.filter(sub => sub.deptName.indexOf(this.keyWords) > -1).map(sub => sub.id)
  306. tmp.forEach(sub => {
  307. const index = this.deptList.findIndex(ele => ele.id === sub)
  308. this.deptList[index].search = true
  309. })
  310. }
  311. }
  312. }
  313. </script>
  314. <style lang="scss" scoped>
  315. .lab {
  316. :deep(.el-form-item__label) {
  317. color: #707070;
  318. font-size: 15px;
  319. font-weight: 500;
  320. }
  321. }
  322. .chose-box {
  323. width: 100%;
  324. border: 1px solid #DDDFE6;
  325. border-radius: 5px;
  326. }
  327. .grid {
  328. display: grid;
  329. grid-template-columns: auto auto auto auto;
  330. }
  331. .org {
  332. border-radius: 8px;
  333. width: 150px;
  334. margin: 10px;
  335. }
  336. .dot {
  337. width: 10px;
  338. height: 10px;
  339. border-radius: 10px;
  340. border: 4px solid #eeeeee;
  341. }
  342. .dot-checked {
  343. width: 10px;
  344. height: 10px;
  345. border-radius: 10px;
  346. border: 4px solid #ECAB56;
  347. .title {
  348. color: white;
  349. }
  350. }
  351. .org-search {
  352. border-radius: 8px;
  353. background: #4E637F;
  354. width: 150px;
  355. margin: 10px;
  356. }
  357. .org-s {
  358. border-radius: 8px;
  359. background: #4E637F;
  360. width: 150px;
  361. margin: 10px;
  362. }
  363. </style>