From 7bea4880ad378d6a0ffef45f2bb15f92f7b80bd0 Mon Sep 17 00:00:00 2001
From: dcc <dcc@163.com>
Date: Tue, 16 Jul 2024 10:15:38 +0800
Subject: [PATCH] 123

---
 src/views/product/markettrading.vue |  579 ++++++++++++++++++++++++++++++---------------------------
 1 files changed, 304 insertions(+), 275 deletions(-)

diff --git a/src/views/product/markettrading.vue b/src/views/product/markettrading.vue
index 1f8c8fe..9aa1ffe 100644
--- a/src/views/product/markettrading.vue
+++ b/src/views/product/markettrading.vue
@@ -43,14 +43,9 @@
 
                 </span>
               </a-form-item> -->
-            <a-button
-              type="primary"
-              icon="plus"
-              style="margin-left: 8px"
-              @click=";(addUserdialog = true), (currentdetail = '')"
-            >
-              添加盘前</a-button
-            >
+            <a-button type="primary" icon="plus" style="margin-left: 8px"
+              @click=";(addUserdialog = true), (currentdetail = '')">
+              添加盘前</a-button>
           </a-col>
         </a-row>
         <!-- </a-form> -->
@@ -58,15 +53,9 @@
     </a-card>
 
     <a-card :bordered="false">
-      <a-table
-        bordered
-        :loading="loading"
-        :pagination="pagination"
-        :columns="columns"
-        :data-source="datalist"
-        rowKey="newlistId"
-      >
-        <span slot="type" slot-scope="text, record">
+      <a-table bordered :loading="loading" :pagination="pagination" :columns="columns" :data-source="datalist"
+        rowKey="newlistId">
+        <!-- <span slot="type" slot-scope="text, record">
           <template>
             <div>
               <a-tag>
@@ -74,7 +63,7 @@
               </a-tag>
             </div>
           </template>
-        </span>
+        </span> -->
 
         <template slot="action" slot-scope="text, record">
           <a slot="action" href="javascript:;" @click="geteditStock(record)">{{ '修改盘前' }}</a>
@@ -84,40 +73,28 @@
       </a-table>
     </a-card>
 
-    <a-modal
-      :title="currentdetail ? '修改盘前' : '添加盘前'"
-      :width="700"
-      :visible="addUserdialog"
-      :confirmLoading="addUserDialogloading"
-      @ok="OkaddUserdialog"
-      @cancel="CanceladdUserdialog"
-    >
+    <a-modal :title="currentdetail ? '修改盘前' : '添加盘前'" :width="700" :visible="addUserdialog"
+      :confirmLoading="addUserDialogloading" @ok="OkaddUserdialog" @cancel="CanceladdUserdialog">
       <a-form :form="addUserform" ref="addUserform">
         <a-row :gutter="48">
           <a-col :md="12" :lg="12" :sm="12">
             <a-form-item label="股票代码" :labelCol="labelCol" :wrapperCol="wrapperCol">
-              <a-input
-                placeholder="请输入股票代码"
-                v-decorator="['stockCode', { rules: [{ required: true, message: '请输入股票代码' }] }]"
-              />
+              <a-input placeholder="请输入股票代码"
+                v-decorator="['stockCode', { rules: [{ required: true, message: '请输入股票代码' }] }]" />
             </a-form-item>
           </a-col>
           <a-col :md="12" :lg="12" :sm="12">
             <a-form-item label="股票名称" :labelCol="labelCol" :wrapperCol="wrapperCol">
-              <a-input
-                placeholder="请输入股票名称"
-                v-decorator="['stockName', { rules: [{ required: true, message: '请输入股票名称' }] }]"
-              />
+              <a-input placeholder="请输入股票名称"
+                v-decorator="['stockName', { rules: [{ required: true, message: '请输入股票名称' }] }]" />
             </a-form-item>
           </a-col>
         </a-row>
         <a-row :gutter="48">
           <a-col :md="12" :lg="12" :sm="12">
             <a-form-item label="盘前价格" :labelCol="labelCol" :wrapperCol="wrapperCol">
-              <a-input
-                placeholder="请输入盘前价格"
-                v-decorator="['price', { rules: [{ required: true, message: '请输入盘前价格' }] }]"
-              />
+              <a-input placeholder="请输入盘前价格"
+                v-decorator="['price', { rules: [{ required: true, message: '请输入盘前价格' }] }]" />
             </a-form-item>
           </a-col>
           <!-- <a-col :md="12" :lg="12" :sm="12">
@@ -134,20 +111,40 @@
           </a-col> -->
         </a-row>
         <a-row :gutter="48">
-          <a-col :md="12" :lg="12" :sm="12">
+          <!-- <a-col :md="12" :lg="12" :sm="12">
             <a-form-item label="股票开始时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
-              <a-input
-                placeholder="请输入股票调价开始时间"
+              <a-time-picker :needConfirm="true" placeholder="请选择时间"
+              @change="getstartTime"
                 v-decorator="['startTime', { rules: [{ required: true, message: '请输入股票调价开始时间' }] }]"
-              />
+                 format="HH:mm:ss" />
             </a-form-item>
           </a-col>
           <a-col :md="12" :lg="12" :sm="12">
             <a-form-item label="股票结束时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
-              <a-input
-                placeholder="请输入股票结束时间"
+              <a-time-picker placeholder="请选择时间" :needConfirm="true"
+              @change="getendTime"
                 v-decorator="['endTime', { rules: [{ required: true, message: '请输入股票结束时间' }] }]"
-              />
+                 format="HH:mm:ss" />
+            </a-form-item>
+          </a-col> -->
+          <a-col :md="12" :lg="12" :sm="12">
+            <a-form-item label="股票开始时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
+            <a-date-picker show-time :needConfirm="true" @change="changeStartTime"
+                           v-model:value="startTime" format="YYYY-MM-DD HH:mm:ss" />
+<!--             <a-input-->
+<!--                placeholder="请输入时间 例 12:00"-->
+<!--                v-decorator="['startTime', { rules: [{ required: true, message: '请输入股票调价开始时间' }] }]"-->
+<!--              />-->
+            </a-form-item>
+          </a-col>
+          <a-col :md="12" :lg="12" :sm="12">
+            <a-form-item label="股票结束时间" :labelCol="labelCol" :wrapperCol="wrapperCol">
+<!--              <a-input-->
+<!--                placeholder="请输入时间 例 12:00"-->
+<!--                v-decorator="['endTime', { rules: [{ required: true, message: '请输入股票结束时间' }] }]"-->
+<!--              />-->
+              <a-date-picker show-time :needConfirm="true" @change="changeEndTime"
+                             v-model:value="endTime" format="YYYY-MM-DD HH:mm:ss" />
             </a-form-item>
           </a-col>
         </a-row>
@@ -156,242 +153,274 @@
   </page-header-wrapper>
 </template>
 <script>
-import { SettingqueryAll, stockupdata, stockadd, stockdelete } from '@/api/allsetting'
-import moment from 'moment'
-import pick from 'lodash.pick'
-export default {
-  name: 'Shares',
-  data() {
-    return {
-      columns: [
-        {
-          title: '股票代码',
-          dataIndex: 'stockCode',
-          align: 'center',
-        },
-        {
-          title: '股票名称',
-          dataIndex: 'stockName',
-          align: 'center',
-        },
-        {
-          title: '股票开始时间',
-          dataIndex: 'startTime',
-          align: 'center',
-        },
-        {
-          title: '股票结束时间',
-          dataIndex: 'endTime',
-          align: 'center',
-        },
-        {
-          title: '类型',
-          dataIndex: 'type',
-          align: 'center',
-          scopedSlots: { customRender: 'type' },
-        },
-        {
-          title: '金额',
-          dataIndex: 'price',
-          align: 'center',
-        },
+  import {
+    SettingqueryAll,
+    stockupdata,
+    stockadd,
+    stockdelete
+  } from '@/api/allsetting'
+  import moment from 'moment'
+  import pick from 'lodash.pick'
+  export default {
+    name: 'Shares',
+    data() {
+      return {
+        columns: [{
+            title: '股票代码',
+            dataIndex: 'stockCode',
+            align: 'center',
+          },
+          {
+            title: '股票名称',
+            dataIndex: 'stockName',
+            align: 'center',
+          },
+          {
+            title: '股票开始时间',
+            dataIndex: 'startTime',
+            align: 'center',
+          },
+          {
+            title: '股票结束时间',
+            dataIndex: 'endTime',
+            align: 'center',
+          },
+          // {
+          //   title: '类型',
+          //   dataIndex: 'type',
+          //   align: 'center',
+          //   scopedSlots: {
+          //     customRender: 'type'
+          //   },
+          // },
+          {
+            title: '金额',
+            dataIndex: 'price',
+            align: 'center',
+          },
 
-        {
-          title: '操作',
-          key: 'action',
-          align: 'center',
-          scopedSlots: {
-            customRender: 'action',
+          {
+            title: '操作',
+            key: 'action',
+            align: 'center',
+            scopedSlots: {
+              customRender: 'action',
+            },
+          },
+        ],
+        disabledDate: true,
+        // 表头
+        pagination: {
+          total: 0,
+          current: 1,
+          pageSize: 10, // 每页中显示10条数据
+          showSizeChanger: true,
+          pageSizeOptions: ['10', '20', '50', '100'], // 每页中显示的数据
+          onShowSizeChange: (current, pageSize) => this.onSizeChange(current, pageSize), // 改变每页数量时更新显示
+          onChange: (page, pageSize) => this.onPageChange(page, pageSize), // 点击页码事件
+          showTotal: (total) => `共有 ${total} 条数据`, // 分页中显示总的数据
+        },
+        loading: false,
+        typeValue: 0,
+        queryParam: {
+          pageNum: 1,
+          pageSize: 10,
+          code: '',
+          name: '',
+          zt: undefined,
+          type: 0,
+        },
+        datalist: [],
+        labelCol: {
+          xs: {
+            span: 8,
+          },
+          sm: {
+            span: 8,
+          },
+          md: {
+            span: 8,
           },
         },
-      ],
-      disabledDate: true,
-      // 表头
-      pagination: {
-        total: 0,
-        current: 1,
-        pageSize: 10, // 每页中显示10条数据
-        showSizeChanger: true,
-        pageSizeOptions: ['10', '20', '50', '100'], // 每页中显示的数据
-        onShowSizeChange: (current, pageSize) => this.onSizeChange(current, pageSize), // 改变每页数量时更新显示
-        onChange: (page, pageSize) => this.onPageChange(page, pageSize), // 点击页码事件
-        showTotal: (total) => `共有 ${total} 条数据`, // 分页中显示总的数据
-      },
-      loading: false,
-      typeValue: 0,
-      queryParam: {
-        pageNum: 1,
-        pageSize: 10,
-        code: '',
-        name: '',
-        zt: undefined,
-        type: 0,
-      },
-      datalist: [],
-      labelCol: {
-        xs: {
-          span: 8,
+        wrapperCol: {
+          xs: {
+            span: 14,
+          },
+          sm: {
+            span: 14,
+          },
+          md: {
+            span: 14,
+          },
         },
-        sm: {
-          span: 8,
-        },
-        md: {
-          span: 8,
-        },
-      },
-      wrapperCol: {
-        xs: {
-          span: 14,
-        },
-        sm: {
-          span: 14,
-        },
-        md: {
-          span: 14,
-        },
-      },
-      addUserform: this.$form.createForm(this),
-      addUserdialog: false,
-      addUserDialogloading: false,
-
-      fields: ['stockCode', 'stockName', 'startTime', 'endTime', 'type', 'price'],
-      currentdetail: '',
-      subscribeTime: '',
-      subscriptionTime: '',
-    }
-  },
-  created() {
-    this.getlist()
-  },
-  methods: {
-    getdeleteStock(val) {
-      var that = this
-      this.$confirm({
-        title: '提示',
-        content: '确认删除该盘前吗?此操作不可恢复!',
-        onOk() {
-          var data = {
-            id: val.id,
-          }
-          stockdelete(data).then((res) => {
-            if (res.status == 0) {
-              that.$message.success({
-                content: res.msg,
-                duration: 2,
-              })
-              that.getinit()
-            } else {
-              that.$message.error({
-                content: res.msg,
-              })
-            }
-          })
-        },
-        onCancel() {
-          console.log('Cancel')
-        },
-      })
-    },
-    getsubscribeTime(date, dateString) {
-      this.subscribeTime = dateString
-    },
-    getsubscriptionTime(date, dateString) {
-      this.subscriptionTime = dateString
-    },
-    geteditStock(val) {
-      this.currentdetail = val
-      this.addUserdialog = true
-      var currentTime = new Date()
-      this.fields.forEach((v) => this.addUserform.getFieldDecorator(v))
-      this.addUserform.setFieldsValue(pick(val, this.fields))
-      this.addUserform.setFieldsValue({
-        subscriptionTime: moment(val.subscriptionTime ? val.subscriptionTime : currentTime).format(
-          'YYYY-MM-DD HH:mm:ss'
-        ),
-      })
-      this.addUserform.setFieldsValue({
-        subscribeTime: moment(val.subscribeTime ? val.subscribeTime : currentTime).format('YYYY-MM-DD HH:mm:ss'),
-      })
-    },
-    CanceladdUserdialog() {
-      this.addUserdialog = false
-      const form = this.$refs.addUserform.form
-      form.resetFields()
-    },
-    OkaddUserdialog() {
-      const form = this.$refs.addUserform.form
-
-      form.validateFields((errors, values) => {
-        values.type = 0
-        if (!errors) {
-          if (this.currentdetail != '') {
-            this.addUserDialogloading = true
-            values.id = this.currentdetail.id
-
-            // values.subscriptionTime = this.subscriptionTime
-            // values.subscribeTime = this.subscribeTime
-            stockupdata(values).then((res) => {
-              if (res.status == 0) {
-                this.addUserdialog = false
-                this.$message.success('修改成功')
-                form.resetFields()
-                this.getlist()
-              } else {
-                this.$message.error(res.msg)
-              }
-              this.addUserDialogloading = false
-            })
-          } else {
-            this.addUserDialogloading = true
-            stockadd(values).then((res) => {
-              if (res.status == 0) {
-                this.addUserdialog = false
-                this.$message.success(res.msg)
-                form.resetFields()
-                this.getinit()
-              } else {
-                this.$message.error(res.msg)
-              }
-              this.addUserDialogloading = false
-            })
-          }
-        }
-      })
-    },
-    getqueryParam() {
-      this.queryParam = {
-        pageNum: 1,
-        pageSize: 10,
-        code: '',
-        name: '',
-        zt: undefined,
-        type: undefined,
+        addUserform: this.$form.createForm(this),
+        addUserdialog: false,
+        addUserDialogloading: false,
+        endTime:'',
+        startTime:'',
+        fields: ['stockCode', 'stockName', 'startTime', 'endTime', 'type', 'price'],
+        currentdetail: '',
+        subscribeTime: '',
+        subscriptionTime: '',
       }
     },
-    getinit() {
-      this.getqueryParam()
-      this.pagination.current = 1
+    created() {
       this.getlist()
     },
-    getlist() {
-      this.loading = true
-      SettingqueryAll(this.queryParam).then((res) => {
-        this.datalist = res.data
-        this.pagination.total = res.data.total
-        this.loading = false
-      })
+    methods: {
+      changeEndTime(time,timeString){
+        this.endTime = timeString
+      },
+      changeStartTime(time,timeString){
+        this.startTime = timeString
+      },
+      getdeleteStock(val) {
+        var that = this
+        this.$confirm({
+          title: '提示',
+          content: '确认删除该盘前吗?此操作不可恢复!',
+          onOk() {
+            var data = {
+              id: val.id,
+            }
+            stockdelete(data).then((res) => {
+              if (res.status == 0) {
+                that.$message.success({
+                  content: res.msg,
+                  duration: 2,
+                })
+                that.getinit()
+              } else {
+                that.$message.error({
+                  content: res.msg,
+                })
+              }
+            })
+          },
+          onCancel() {
+            console.log('Cancel')
+          },
+        })
+      },
+      getendTime(date, dateString) {
+        console.log(date, dateString);
+        this.endTime = dateString
+      },
+
+      getstartTime(date, dateString) {
+        this.startTime = dateString
+      },
+      getsubscribeTime(date, dateString) {
+        this.subscribeTime = dateString
+      },
+      getsubscriptionTime(date, dateString) {
+        this.subscriptionTime = dateString
+      },
+      geteditStock(val) {
+        this.currentdetail = val
+        this.addUserdialog = true
+        var currentTime = new Date()
+        this.fields.forEach((v) => this.addUserform.getFieldDecorator(v))
+        this.addUserform.setFieldsValue(pick(val, this.fields))
+        this.addUserform.setFieldsValue({
+          subscriptionTime: moment(val.subscriptionTime ? val.subscriptionTime : currentTime).format(
+            'YYYY-MM-DD HH:mm:ss'
+          ),
+        })
+        this.addUserform.setFieldsValue({
+          subscribeTime: moment(val.subscribeTime ? val.subscribeTime : currentTime).format('YYYY-MM-DD HH:mm:ss'),
+        })
+        // this.addUserform.setFieldsValue({
+        //   endTime: moment(val.endTime ? val.endTime : currentTime).format('HH:mm:ss'),
+        //   // endTime: moment(currentTime).format('YYYY-MM-DD HH:mm:ss')
+        // })
+        // this.addUserform.setFieldsValue({
+        //   startTime: moment(val.startTime ? val.startTime : currentTime).format('HH:mm:ss'),
+        // })
+
+      },
+      CanceladdUserdialog() {
+        this.addUserdialog = false
+        const form = this.$refs.addUserform.form
+        form.resetFields()
+      },
+      OkaddUserdialog() {
+        const form = this.$refs.addUserform.form
+
+        form.validateFields((errors, values) => {
+          values.type = 0
+          if (!errors) {
+            if (this.currentdetail != '') {
+              this.addUserDialogloading = true
+              values.id = this.currentdetail.id
+              values.endTime = this.endTime
+              values.startTime = this.startTime
+              // values.subscriptionTime = this.endTime
+              // values.subscribeTime = this.startTime
+              stockupdata(values).then((res) => {
+                if (res.status == 0) {
+                  this.addUserdialog = false
+                  this.$message.success('修改成功')
+                  form.resetFields()
+                  this.getlist()
+                } else {
+                  this.$message.error(res.msg)
+                }
+                this.addUserDialogloading = false
+              })
+            } else {
+              this.addUserDialogloading = true
+              values.endTime = this.endTime
+              values.startTime = this.startTime
+              stockadd(values).then((res) => {
+                if (res.status == 0) {
+                  this.addUserdialog = false
+                  this.$message.success(res.msg)
+                  form.resetFields()
+                  this.getinit()
+                } else {
+                  this.$message.error(res.msg)
+                }
+                this.addUserDialogloading = false
+              })
+            }
+          }
+        })
+      },
+      getqueryParam() {
+        this.queryParam = {
+          pageNum: 1,
+          pageSize: 10,
+          code: '',
+          name: '',
+          zt: undefined,
+          type: undefined,
+        }
+      },
+      getinit() {
+        this.getqueryParam()
+        this.pagination.current = 1
+        this.getlist()
+      },
+      getlist() {
+        this.loading = true
+        SettingqueryAll(this.queryParam).then((res) => {
+          this.datalist = res.data
+          this.pagination.total = res.data.total
+          this.loading = false
+        })
+      },
+      onPageChange(page, pageSize) {
+        this.queryParam.pageNum = page
+        this.pagination.current = page
+        this.getlist()
+      },
+      onSizeChange(current, pageSize) {
+        this.queryParam.pageNum = current
+        this.pagination.current = page
+        this.queryParam.pageSize = pageSize
+        this.getlist()
+      },
     },
-    onPageChange(page, pageSize) {
-      this.queryParam.pageNum = page
-      this.pagination.current = page
-      this.getlist()
-    },
-    onSizeChange(current, pageSize) {
-      this.queryParam.pageNum = current
-      this.pagination.current = page
-      this.queryParam.pageSize = pageSize
-      this.getlist()
-    },
-  },
-}
-</script>
+  }
+</script>
\ No newline at end of file

--
Gitblit v1.9.3