index.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. <template>
  2. <div class="app-container">
  3. <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
  4. <el-form-item label="年份" prop="configName">
  5. <el-date-picker
  6. v-model="queryParams.year"
  7. type="year"
  8. value-format="yyyy"
  9. placeholder="选择年"
  10. size="small"
  11. @keyup.enter.native="handleQuery"
  12. >
  13. </el-date-picker>
  14. </el-form-item>
  15. <el-form-item label="部门" prop="sysDeptId">
  16. <el-cascader :options="typeOptionstwo" :props="{value: 'id'}" @change="changeBtn" :show-all-levels="false"></el-cascader>
  17. <!-- <el-select
  18. v-model="queryParams.sysDeptId"
  19. placeholder="请选择部门"
  20. clearable
  21. size="small"
  22. >
  23. <el-option
  24. v-for="dict in typeOptionstwo"
  25. :key="dict.deptId"
  26. :label="dict.deptName"
  27. :value="dict.deptId"
  28. /> -->
  29. </el-select>
  30. </el-form-item>
  31. <el-form-item>
  32. <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
  33. <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
  34. </el-form-item>
  35. </el-form>
  36. <el-row :gutter="10" class="mb8">
  37. <el-col :span="1.5">
  38. <el-button
  39. type="primary"
  40. plain
  41. icon="el-icon-plus"
  42. size="mini"
  43. @click="handleAdd"
  44. v-hasPermi="['deptplan:Plan:add']"
  45. >新增</el-button>
  46. </el-col>
  47. <el-col :span="1.5">
  48. <el-button
  49. type="success"
  50. plain
  51. icon="el-icon-edit"
  52. size="mini"
  53. :disabled="single"
  54. @click="handleUpdate"
  55. v-hasPermi="['deptplan:Plan:edit']"
  56. >修改</el-button>
  57. </el-col>
  58. <el-col :span="1.5">
  59. <el-button
  60. type="danger"
  61. plain
  62. icon="el-icon-delete"
  63. size="mini"
  64. :disabled="multiple"
  65. @click="handleDelete"
  66. v-hasPermi="['deptplan:Plan:remove']"
  67. >删除</el-button>
  68. </el-col>
  69. <el-col :span="1.5">
  70. <el-button
  71. type="warning"
  72. plain
  73. icon="el-icon-download"
  74. size="mini"
  75. @click="handleExport"
  76. v-hasPermi="['deptplan:Plan:export']"
  77. >导出</el-button>
  78. </el-col>
  79. <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  80. </el-row>
  81. <el-table v-loading="loading" :data="planList" @selection-change="handleSelectionChange">
  82. <el-table-column type="selection" width="55" align="center" />
  83. <el-table-column label="年度" align="center" prop="year" />
  84. <el-table-column label="部门" align="center" prop="deptName" />
  85. <el-table-column label="目标线索数" align="center" prop="plan" />
  86. <el-table-column label="目标签约数" align="center" prop="targetSigningNum" />
  87. <el-table-column label="目标合同金额" align="center" prop="targetContractAmount" />
  88. <el-table-column label="目标到资金额" align="center" prop="targetArrivalAmount" />
  89. <el-table-column label="目标投产项目数" align="center" prop="targetInvestmentNum" />
  90. <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  91. <template slot-scope="scope">
  92. <el-button
  93. size="mini"
  94. type="text"
  95. icon="el-icon-edit"
  96. @click="handleUpdate(scope.row)"
  97. v-hasPermi="['deptplan:Plan:edit']"
  98. >修改</el-button>
  99. <el-button
  100. size="mini"
  101. type="text"
  102. icon="el-icon-delete"
  103. @click="handleDelete(scope.row)"
  104. v-hasPermi="['deptplan:Plan:remove']"
  105. >删除</el-button>
  106. </template>
  107. </el-table-column>
  108. </el-table>
  109. <pagination
  110. v-show="total>0"
  111. :total="total"
  112. :page.sync="queryParams.pageNum"
  113. :limit.sync="queryParams.pageSize"
  114. @pagination="getList"
  115. />
  116. <!-- 添加或修改 部门招商计划对话框 -->
  117. <el-dialog :close-on-click-modal="false" :title="title" :visible.sync="open" width="800px" append-to-body>
  118. <el-form ref="form" :model="form" :rules="rules" label-width="150px">
  119. <el-form-item label="年度" prop="year">
  120. <el-date-picker
  121. v-model="form.year"
  122. type="year"
  123. value-format="yyyy"
  124. placeholder="选择年"
  125. style="width: 100%;"
  126. >
  127. </el-date-picker>
  128. </el-form-item>
  129. <el-form-item label="部门" prop="sysDeptId">
  130. <el-cascader :options="typeOptionstwo" :props="{value: 'id'}" v-model="form.sysDeptId" @change="changeBtn1" :show-all-levels="false"></el-cascader>
  131. </el-form-item>
  132. <el-form-item label="目标线索数" prop="plan">
  133. <el-input v-model="form.plan" placeholder="请输入目标线索数" />
  134. </el-form-item>
  135. <el-form-item label="目标签约数" prop="targetSigningNum">
  136. <el-input v-model="form.targetSigningNum" placeholder="请输入目标签约数" />
  137. </el-form-item>
  138. <el-form-item label="目标合同金额" prop="targetContractAmount">
  139. <el-input v-model="form.targetContractAmount" placeholder="请输入目标合同金额" />
  140. </el-form-item>
  141. <el-form-item label="目标到资金额" prop="targetArrivalAmount">
  142. <el-input v-model="form.targetArrivalAmount" placeholder="请输入目标到资金额" />
  143. </el-form-item>
  144. <el-form-item label="目标投产项目数" prop="targetInvestmentNum">
  145. <el-input v-model="form.targetInvestmentNum" placeholder="请输入目标投产项目数" />
  146. </el-form-item>
  147. </el-form>
  148. <div slot="footer" class="dialog-footer">
  149. <el-button type="primary" @click="submitForm">确 定</el-button>
  150. <el-button @click="cancel">取 消</el-button>
  151. </div>
  152. </el-dialog>
  153. </div>
  154. </template>
  155. <script>
  156. import { listPlan, getPlan, delPlan, addPlan, updatePlan, exportPlan } from "@/api/deptplan/plan";
  157. import {listConfigfieu} from "@/api/system/config";
  158. export default {
  159. name: "Plan",
  160. components: {
  161. },
  162. data() {
  163. return {
  164. // 遮罩层
  165. loading: true,
  166. // 选中数组
  167. ids: [],
  168. // 非单个禁用
  169. single: true,
  170. // 非多个禁用
  171. multiple: true,
  172. // 显示搜索条件
  173. showSearch: true,
  174. // 总条数
  175. total: 0,
  176. // 部门招商计划表格数据
  177. planList: [],
  178. // 弹出层标题
  179. title: "",
  180. // 是否显示弹出层
  181. open: false,
  182. typeOptionstwo:[],
  183. // 查询参数
  184. queryParams: {
  185. pageNum: 1,
  186. pageSize: 10,
  187. sysDeptId: null,
  188. isDel: null,
  189. year: null,
  190. plan: null,
  191. targetSigningNum: null,
  192. targetContractAmount: null,
  193. targetArrivalAmount: null,
  194. targetInvestmentNum: null,
  195. typeOptionstwo:[]
  196. },
  197. // 表单参数
  198. form: {
  199. year: new Date()
  200. },
  201. // 表单校验
  202. rules: {
  203. targetSigningNum:[
  204. { required: true, message: '请输入目标签约数', trigger: 'change' }
  205. ],
  206. targetContractAmount:[
  207. { required: true, message: '请输入目标合同金额', trigger: 'change' }
  208. ],
  209. targetArrivalAmount:[
  210. { required: true, message: '请输入目标到资金额', trigger: 'change' }
  211. ],
  212. targetInvestmentNum:[
  213. { required: true, message: '请输入目标投产项目数', trigger: 'change' }
  214. ],
  215. plan:[
  216. { required: true, message: '请输入计划', trigger: 'change' }
  217. ],
  218. sysDeptId: [
  219. { required: true, message: '请选择部门', trigger: 'change' }
  220. ],
  221. year: [
  222. { type: 'string', required: true, message: '请选择年份', trigger: 'change' }
  223. ],
  224. }
  225. };
  226. },
  227. created() {
  228. this.getList();
  229. this.getListthuy()
  230. },
  231. methods: {
  232. changeBtn(e){
  233. if(e.length == 1){
  234. this.queryParams.sysDeptId = e.join(',')
  235. }else{
  236. this.queryParams.sysDeptId = e[e.length-1]
  237. }
  238. },
  239. changeBtn1(e){
  240. if(e.length == 1){
  241. this.form.sysDeptId = e.join(',')
  242. }else{
  243. this.form.sysDeptId = e[e.length-1]
  244. }
  245. console.log(e[e.length-1])
  246. },
  247. /** 查询 部门招商计划列表 */
  248. getList() {
  249. this.loading = true;
  250. listPlan(this.queryParams).then(response => {
  251. this.planList = response.rows;
  252. this.total = response.total;
  253. this.loading = false;
  254. });
  255. },
  256. //部门列表
  257. getListthuy() {
  258. this.loading = true;
  259. listConfigfieu().then((response) => {
  260. console.log(response.data)
  261. this.typeOptionstwo = response.data;
  262. // this.fileList = this.queryParams.attachment
  263. // this.total = response.total;
  264. this.loading = false;
  265. });
  266. },
  267. // 取消按钮
  268. cancel() {
  269. this.open = false;
  270. this.reset();
  271. },
  272. // 表单重置
  273. reset() {
  274. this.form = {
  275. id: null,
  276. sysDeptId: null,
  277. createBy: null,
  278. createTime: null,
  279. updateBy: null,
  280. updateTime: null,
  281. isDel: null,
  282. year: null,
  283. plan: null,
  284. targetSigningNum: null,
  285. targetContractAmount: null,
  286. targetArrivalAmount: null,
  287. targetInvestmentNum: null
  288. };
  289. this.resetForm("form");
  290. },
  291. /** 搜索按钮操作 */
  292. handleQuery() {
  293. this.queryParams.pageNum = 1;
  294. this.getList();
  295. },
  296. /** 重置按钮操作 */
  297. resetQuery() {
  298. this.resetForm("queryForm");
  299. this.handleQuery();
  300. },
  301. // 多选框选中数据
  302. handleSelectionChange(selection) {
  303. this.ids = selection.map(item => item.id)
  304. this.single = selection.length!==1
  305. this.multiple = !selection.length
  306. },
  307. /** 新增按钮操作 */
  308. handleAdd() {
  309. this.reset();
  310. this.open = true;
  311. this.title = "添加 部门招商计划";
  312. },
  313. /** 修改按钮操作 */
  314. handleUpdate(row) {
  315. this.reset();
  316. const id = row.id || this.ids
  317. getPlan(id).then(response => {
  318. this.form = response.data;
  319. // this.form.sysDeptId = response.data.sysDeptId.split(',')
  320. // console.log( response.data.sysDeptId.length)
  321. this.open = true;
  322. this.title = "修改 部门招商计划";
  323. });
  324. },
  325. /** 提交按钮 */
  326. submitForm() {
  327. this.$refs["form"].validate(valid => {
  328. if (valid) {
  329. if (this.form.id != null) {
  330. updatePlan(this.form).then(response => {
  331. this.msgSuccess("修改成功");
  332. this.open = false;
  333. this.getList();
  334. });
  335. } else {
  336. addPlan(this.form).then(response => {
  337. this.msgSuccess("新增成功");
  338. this.open = false;
  339. this.getList();
  340. });
  341. }
  342. }
  343. });
  344. },
  345. /** 删除按钮操作 */
  346. handleDelete(row) {
  347. const ids = row.id || this.ids;
  348. this.$confirm('是否确认删除 部门招商计划编号为"' + ids + '"的数据项?', "警告", {
  349. confirmButtonText: "确定",
  350. cancelButtonText: "取消",
  351. type: "warning"
  352. }).then(function() {
  353. return delPlan(ids);
  354. }).then(() => {
  355. this.getList();
  356. this.msgSuccess("删除成功");
  357. })
  358. },
  359. /** 导出按钮操作 */
  360. handleExport() {
  361. const queryParams = this.queryParams;
  362. this.$confirm('是否确认导出所有 部门招商计划数据项?', "警告", {
  363. confirmButtonText: "确定",
  364. cancelButtonText: "取消",
  365. type: "warning"
  366. }).then(function() {
  367. return exportPlan(queryParams);
  368. }).then(response => {
  369. this.download(response.msg);
  370. })
  371. }
  372. }
  373. };
  374. </script>