form.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  1. <template>
  2. <div>
  3. <el-drawer class="custom-drawer-form" :title="title" size="800px" append-to-body :visible.sync="drawer" direction="rtl" :before-close="close" destroy-on-close>
  4. <el-container>
  5. <el-main>
  6. <el-form :model="ruleForm" :rules="rules" ref="ruleForm" label-width="120px" class="demo-ruleForm">
  7. <el-form-item label="专题库名称:" prop="name">
  8. <el-input v-model="ruleForm.name" placeholder="请输入专题库名称"></el-input>
  9. </el-form-item>
  10. <template>
  11. <div>
  12. <el-form-item label="委托方:" prop="name" v-if="userinfo.tenantType == 1">
  13. <el-autocomplete
  14. style="width:100%"
  15. v-model="ruleForm.clientName"
  16. :fetch-suggestions="querySearch"
  17. @input="input"
  18. placeholder="请输入内容"
  19. :trigger-on-focus="false"
  20. @select="handleChange"
  21. >
  22. <el-button slot="append" icon="el-icon-search" @click="handleSelect"></el-button>
  23. </el-autocomplete>
  24. </el-form-item>
  25. <el-form-item label="委托部门:" prop="name" v-else>
  26. <mySelectTree style="width:100%" v-model="ruleForm.departmentId" :options="departmentList"></mySelectTree>
  27. </el-form-item>
  28. </div>
  29. </template>
  30. <el-form-item label="负责部门:" prop="departmentId">
  31. <mySelectTree style="width:100%" v-model="ruleForm.departmentId" :options="departmentList"></mySelectTree>
  32. </el-form-item>
  33. <el-form-item label="负责人:" prop="person">
  34. <el-select style="width:100%" v-model="ruleForm.personnelId" filterable remote clearable placeholder="请选择" :loading="loading" v-SelectLazyLoading="lazyLoading" :remote-method="remoteMethod">
  35. <el-option
  36. v-for="item in personnelList"
  37. :key="item.id"
  38. :label="item.name"
  39. :value="item.id"
  40. >
  41. </el-option>
  42. </el-select>
  43. </el-form-item>
  44. <el-form-item label="应用场景:" prop="scenarioList">
  45. <el-checkbox-group v-model="ruleForm.scenarioList" @change="onChange">
  46. <el-checkbox v-for="item in commonData.ENTERPRISE_APPLICATION_SCENARIO" :key="item.value" :label="parseInt(item.value)">{{ item.label }}</el-checkbox>
  47. </el-checkbox-group>
  48. </el-form-item>
  49. <el-form-item label="调查类型:" prop="typeList" v-if="show==true">
  50. <el-checkbox-group v-model="ruleForm.typeList">
  51. <template v-for="(item, index) in dictAssociateData">
  52. <el-checkbox :label="parseInt(item.dictChildValue)">
  53. {{ item.dictChildLabel }}
  54. </el-checkbox>
  55. <div v-if="index === dictAssociateData.length - 1" class="more-data-box">
  56. <el-link v-if="moreData" type="primary" icon="el-icon-arrow-down" @click="handleMoreData(0)">更多
  57. </el-link>
  58. <el-link v-else type="primary" icon="el-icon-arrow-up" @click="handleMoreData(1)">收起</el-link>
  59. </div>
  60. </template>
  61. <div v-show="isShow">
  62. <el-checkbox v-for="item in dictSecondAssociateData" :label="parseInt(item.dictChildValue)">
  63. {{ item.dictChildLabel }}
  64. </el-checkbox>
  65. </div>
  66. </el-checkbox-group>
  67. </el-form-item>
  68. <el-form-item label="产品类别/产品:" prop="productId" v-if="$permission('/workspace/product')">
  69. <div>
  70. <mySelectButton size='large' style="width:100%">
  71. <div slot="select" style="width:100%">
  72. <mySelectTree style="width:100%" v-model="ruleForm.departmentId" :options="departmentList"></mySelectTree>
  73. </div>
  74. </mySelectButton>
  75. </div>
  76. </el-form-item>
  77. <el-row :gutter="24">
  78. <el-col :span="12">
  79. <el-form-item label="合同号:" prop="contractNo">
  80. <el-input v-model="ruleForm.contractNo" placeholder="请输入合同号"></el-input>
  81. </el-form-item>
  82. </el-col>
  83. <el-col :span="12">
  84. <el-form-item label="内部案卷:" prop="innerFile">
  85. <el-input v-model="ruleForm.innerFile" placeholder="请输入内部案卷"></el-input>
  86. </el-form-item>
  87. </el-col>
  88. </el-row>
  89. <el-row :gutter="24">
  90. <el-col :span="12">
  91. <el-form-item label="委案日:" prop="caseDate">
  92. <el-date-picker v-model="ruleForm.caseDate" value-format="yyyy-MM-dd" type="date" placeholder="请选择委案日" class="width_100"></el-date-picker>
  93. </el-form-item>
  94. </el-col>
  95. <el-col :span="12">
  96. <el-form-item label="处理状态:" prop="status">
  97. <el-select v-model="ruleForm.status" placeholder="请输入处理状态" class="width_100">
  98. <el-option value="0" label="处理中"></el-option>
  99. <el-option value="1" label="已完成"></el-option>
  100. </el-select>
  101. </el-form-item>
  102. </el-col>
  103. </el-row>
  104. <el-form-item label="备注:" prop="remark">
  105. <el-input v-model="ruleForm.remark" placeholder="请输入备注" type="textarea"></el-input>
  106. </el-form-item>
  107. </el-form>
  108. </el-main>
  109. <el-footer></el-footer>
  110. </el-container>
  111. </el-drawer>
  112. <el-dialog title="选择委托方" :visible.sync="visible" width="800px" append-to-body destroy-on-close :before-close="close2" top="10vh">
  113. <ClientTable :choseClient="true" @getClient="getClient"></ClientTable>
  114. </el-dialog>
  115. </div>
  116. </template>
  117. <script>
  118. import ClientTable from '@/views/client'
  119. import { mapGetters } from 'vuex';
  120. export default {
  121. components: {
  122. ClientTable
  123. },
  124. props: {
  125. commonData: Object
  126. },
  127. data() {
  128. return {
  129. //抽屉标题
  130. title:'',
  131. //抽屉开关标识
  132. drawer:false,
  133. //表单数据
  134. ruleForm:{},
  135. //表单规则
  136. rules:{},
  137. //控制选择委托方弹窗
  138. visible:false,
  139. //部门列表
  140. departmentList:[],
  141. //人员列表
  142. personnelList:[],
  143. //负责人下拉加载
  144. loading:false,
  145. //显示调查类型
  146. show:false,
  147. //显示更多调查类型
  148. isShow: false,
  149. //显示更多和收起按钮
  150. moreData: true,
  151. //调查类型列表
  152. dictAssociateData: [],
  153. //其他调查类型
  154. dictSecondAssociateData: [],
  155. //用来获取调查类型
  156. test: {
  157. value: '1',
  158. type: 'ENTERPRISE_APPLICATION_SCENARIO',
  159. flag: 1
  160. },
  161. };
  162. },
  163. watch: {},
  164. computed: {
  165. ...mapGetters(['userinfo'])
  166. },
  167. created() {},
  168. mounted() {
  169. },
  170. methods: {
  171. //打开弹窗
  172. open(form,title){
  173. //获取部门列表
  174. this.getDepartment()
  175. //获取人员列表
  176. this.getPersonnelList()
  177. this.ruleForm = form
  178. this.title = title
  179. this.drawer = true
  180. },
  181. //获取部门列表
  182. getDepartment() {
  183. this.$api.getPermissionDepartmentList().then((response) => {
  184. this.departmentList = response.data;
  185. });
  186. },
  187. //获取人员列表
  188. getPersonnelList(){
  189. this.$api.getPermissionPersonnelList().then((response)=>{
  190. this.personnelList=response.data
  191. })
  192. },
  193. //关闭抽屉
  194. close(){
  195. this.drawer = false
  196. },
  197. //远程搜索(建议调取接口获取)
  198. querySearch(queryString, cb) {
  199. // var clientList = this.clientList;
  200. // var results = (queryString ? clientList.filter(this.createFilter(queryString)) : clientList).map(item=>{
  201. // return {
  202. // value:item.name,
  203. // name:item.name,
  204. // id:item.id
  205. // }
  206. // });
  207. // // 调用 callback 返回建议列表的数据
  208. // cb(results);
  209. },
  210. createFilter(queryString) {
  211. return (clientList) => {
  212. return (clientList.name && clientList.name.toLowerCase().indexOf(queryString.toLowerCase()) != -1);
  213. };
  214. },
  215. //输入框输入事件(委托方)
  216. input() {
  217. this.$set(this.ruleForm, 'clientId', -1)
  218. },
  219. //切换选择委托方
  220. handleChange(row) {
  221. this.$set(this.ruleForm, 'clientId', row.id)
  222. this.$set(this.ruleForm, 'clientName', row.name)
  223. this.close2()
  224. },
  225. //打开选择委托方弹窗
  226. handleSelect() {
  227. this.visible = true
  228. },
  229. //获取委托方信息
  230. getClient(row){
  231. this.$set(this.ruleForm, 'clientId', row.id)
  232. this.$set(this.ruleForm, 'clientName', row.name)
  233. this.close2()
  234. },
  235. //关闭委托方弹窗
  236. close2(){
  237. this.visible = false
  238. },
  239. //负责人远程搜索
  240. remoteMethod(){
  241. },
  242. //负责人下拉懒加载
  243. lazyLoading(){
  244. },
  245. //应用场景选择切换
  246. onChange() {
  247. if(this.ruleForm.scenarioList.length!=0){
  248. this.show=true
  249. this.test.value = this.ruleForm.scenarioList.toString()
  250. this.test.flag = 1
  251. this.$api.getDictTreeByParentDictValue(this.test).then(response => {
  252. this.dictAssociateData = response.data
  253. this.test.value = this.ruleForm.scenarioList.toString()
  254. this.test.flag = 0
  255. this.$api.getDictTreeByParentDictValue(this.test).then(response => {
  256. this.dictSecondAssociateData = response.data
  257. })
  258. })
  259. }else{
  260. this.show=false
  261. }
  262. },
  263. //调查类型展开收起
  264. handleMoreData(type) {
  265. if (type === 0) {
  266. this.isShow = true
  267. this.test.value = this.ruleForm.scenarioList.toString()
  268. this.test.flag = 0
  269. this.$api.getDictTreeByParentDictValue(this.test).then(response => {
  270. this.dictSecondAssociateData = response.data
  271. })
  272. } else if (type === 1) {
  273. this.isShow = false
  274. }
  275. this.moreData = !this.moreData
  276. },
  277. },
  278. };
  279. </script>
  280. <style lang="scss" scoped>
  281. </style>