123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439 |
- <template>
- <view>
- <form @submit="add">
- <view class="body">
- <input class="input" style="display:none;" name="coding" :value=coding >
- 编码:</input>
- <input class="input" v-model="coding" />
- <button type="primary" @click="saoma()" class="button1" size="mini">
- <!-- <p class="p">扫码</p> -->
- 扫码
- </button>
- <button type="primary" @click="getMessage(coding)" class="button1" size="mini">
- <!-- <p class="p">获取</p> -->
- 获取
- </button>
- </view>
- <view class="">
- <t-table>
- <t-tr class="tr">
- 名称:{{name}}
- </t-tr>
- <t-tr class="tr">
- 所属机器编码:<input class="input" v-model="machineCoding" disabled="true"/>
- </t-tr>
- <t-tr class="tr">
- 版本号:{{versions}}
- </t-tr>
- <t-tr class="tr">
- 生产人员:{{producePersonnel}}
- </t-tr>
- <t-tr class="tr">
- 生产日期:{{produceDate}}
- </t-tr>
- <t-tr class="tr">
- 出货日期:{{shipmentDate}}
- <button v-show="shipmentDate==''" type="primary" @click="chuhuo(coding)"
- class="button1" size="mini">
- 出货
- </button>
- </t-tr>
- <view class="" v-if="installPersonnel!=''&&installPersonnel!=null">
- <t-tr class="tr">
- 装配人员:{{installPersonnel}}
- </t-tr>
- <t-tr class="tr">
- 装配日期:{{installDate}}
- </t-tr>
- </view>
- <view class="" v-if="replateDate!=''&&replateDate!=null">
- <!-- <view class="" v-if="replacePersonnel!=''&&replacePersonnel!=null"> -->
- <t-tr class="tr">
- 本模块更换人员:{{replacePersonnel}}
- </t-tr>
- <t-tr class="tr">
- 本模块更换原因:<input class="input" v-model="replaceReason" />
- <button type="primary" @click="updateReplaceReason()" class="button1" size="mini">
- <!-- <p class="p">更正</p> -->
- 更正
- </button>
- </t-tr>
- <t-tr class="tr">
- 本模块更换日期:{{replateDate}}
- </t-tr>
- </view>
- <view class="" v-if="oldReplateDate!=''&&oldReplateDate!=null">
- <!-- <view class="" v-if="replacePersonnel!=''&&replacePersonnel!=null"> -->
- <t-tr class="tr">
- 旧模块更换人员:{{oldReplacePersonnel}}
- </t-tr>
- <t-tr class="tr">
- 旧模块更换原因:{{oldReplaceReason}}
- </t-tr>
- <t-tr class="tr" v-if="oldCoding!=null">
- 旧模块编号:{{oldCoding}}
- </t-tr>
- <t-tr class="tr">
- 旧模块更换日期:{{oldReplateDate}}
- </t-tr>
- </view>
- <t-tr class="tr">
- 状态:{{status}}
- </t-tr>
- <t-tr class="ttr">
- 操作:
- <button v-if="status!=''" type="primary" @click="change(coding,machineCoding)"
- class="button1" size="mini">
- 更换
- </button>
- <button v-if="level>2" type="primary" @click="del(coding)" class="button1" size="mini">
- 删除
- </button>
- </t-tr>
- </t-table>
- </view>
- <view class="title">配件</view>
- <!-- <view class="lis" v-for="item in desList">
- {{item}}
- </view> -->
- <view class="lis" v-for="(item,index) in desList" :key="index">
- {{item}}
- </view>
- </form>
- </view>
- </template>
- <script>
- import {
- mapState,
- mapActions,
- mapMutations
- } from 'vuex';
- import timeSelector from '@/components/wing-time-selector/wing-time-selector.vue';
- export default {
- components: {
- timeSelector
- },
- data() {
- return {
- oldCoding: '',
- replateDate: '',
- replaceReason: '',
- replacePersonnel: '',
- shipmentDate:'',
- oldReplateDate: '',
- oldReplaceReason: '',
- oldReplacePersonnel: '',
- installDate: '',
- installPersonnel: '',
- produceDate: '',
- coding: '',
- name: '',
- versions: '',
- producePersonnel: '',
- machineCoding: '',
- status: '',
- level: 0,
- desList: {}
- }
- },
- onShow() {
- var token = uni.getStorageSync("token");
- if (token.length > 2) {
- var coding = uni.getStorageSync("selectCoding");
- if (coding.length > 2) {
- this.coding = coding;
- this.getMessage(coding);
- }
- }
- var level = uni.getStorageSync("level");
- this.level = level;
- },
- methods: {
- saoma() {
- var that = this;
- // 允许从相机和相册扫码
- uni.scanCode({
- success(res) {
- that.coding = res.result.replace(/\s+/g, '');
- }
- });
- },
- del(coding) {
- uni.showModal({
- title: '删除',
- content: '确定执行操作?',
- success: (res) => {
- if (res.confirm) {
- var that = this;
- var serverUrl = that.serverurl;
- var token = uni.getStorageSync("token");
- uni.request({
- url: serverUrl + "/TModules/deleteModules?coding=" + coding,
- method: "GET",
- header: {
- 'token': token
- },
- success: (Result) => {
- // console.log(Result);
- var res = Result;
- uni.showModal({
- title: '提示',
- content: res.data.message,
- });
- }
- });
- }
- }
- });
- },
- chuhuo(coding){
- uni.showModal({
- title: '出货',
- content: '确定执行操作?',
- success: (res) => {
- if (res.confirm) {
- var that = this;
- var serverUrl = that.serverurl;
- var token = uni.getStorageSync("token");
- uni.request({
- url: serverUrl + "/TModules/chuhuo?coding=" + coding,
- method: "GET",
- header: {
- 'token': token
- },
- success: (Result) => {
- // console.log(Result);
- var res = Result;
- uni.showModal({
- title: '提示',
- content: res.data.message,
- });
- }
- });
- }
- }
- });
- },
- updateReplaceReason(){
- var that = this;
- var serverUrl = that.serverurl;
- var token = uni.getStorageSync("token");
- uni.request({
- url: serverUrl + "/TModules/updateReplaceReason",
- method: "POST",
- header: {
- 'token': token
- },
- data:{
- "coding":that.coding,
- "replaceReason":that.replaceReason
- },
- success: (Result) => {
- // console.log(Result);
- var res = Result;
- uni.showModal({
- title: '提示',
- content: res.data.message,
- });
- }
- });
- },
- change(coding, machineCoding) {
- uni.navigateTo({
- url: '/pages/select/update?coding=' + coding + '&machineCoding=' + machineCoding,
- });
- },
- getMessage(coding) {
- var that = this;
- var serverUrl = that.serverurl;
- var token = uni.getStorageSync("token");
- uni.request({
- url: serverUrl + "/TModules/getModules?coding=" + coding.replace(/\s+/g, ''),
- method: "GET",
- header: {
- 'token': token
- },
- success: (Result) => {
- console.log("1");
- var res = Result;
- if (res.data.code == true) {
- var codes = res.data.data;
- that.name = codes.name;
- var co = codes.coding;
- if (co.substring(0, 4) != '1000') {
- that.versions = co.substring(8, 10);
- that.producePersonnel = codes.producePersonnel;
- that.produceDate = codes.createDate;
- var sta = codes.status;
- if (sta == '0' || sta == null) {
- that.status = "未安装";
- }
- if (sta == '1') {
- that.status = "已安装";
- }
- if (sta == '2') {
- that.status = "已替换";
- }
- that.machineCoding = codes.machineCoding;
- } else {
- that.versions = co.substring(co.length - 3, co.length);
- // that.producePersonnel = "";
- // that.produceDate = "";
- var sta = codes.status;
- if (sta == '0') {
- that.status = "未安装";
- }
- if (sta == '1') {
- that.status = "已安装";
- }
- if (sta == '2') {
- that.status = "已替换";
- }
- that.producePersonnel = codes.producePersonnel;
- that.produceDate = codes.createDate;
- if (codes.machineCoding != null) {
- that.machineCoding = codes.machineCoding;
- }
- }
- if (codes.flagCode.length > 1) {
- that.desList = codes.flagCode.split(",");
- }
- if (codes.shipmentDate != null) {
- that.shipmentDate = codes.shipmentDate;
- }
- that.installDate = codes.installDate;
- that.installPersonnel = codes.installPersonnel;
- that.replateDate = codes.replateDate;
- that.replaceReason = codes.replaceReason;
- that.replacePersonnel = codes.replacePersonnel;
- that.oldCoding = codes.oldCoding;
- that.oldReplateDate = codes.oldReplateDate;
- that.oldReplaceReason = codes.oldReplaceReason;
- that.oldReplacePersonnel = codes.oldReplacePersonnel;
- // if (co.substring(0, 4) != '1000') {
- // that.oldCoding = codes.oldCoding;
- // } else {
- // that.oldCoding = '';
- // }
- } else {
- uni.showModal({
- content: res.data.message,
- });
- }
- }
- });
- }
- }
- }
- </script>
- <style>
- .body {
- background-color: #FFFFFF;
- padding: 20upx 20upx 20upx 20upx;
- font-size: 30upx;
- display: flex;
- flex-direction: row;
- justify-content: flex-start;
- }
- .ttr {
- padding-left: 30upx;
- padding-top: 13upx;
- font-size: 30upx;
- padding-bottom: 13upx;
- display: flex;
- /* flex-direction: row; */
- gap: 20upx;
- justify-content: flex-start;
-
- }
- .tr {
- padding-left: 30upx;
- padding-top: 13upx;
- font-size: 30upx;
- padding-bottom: 13upx;
- }
- .input {
- /* padding: 10upx 20upx 10upx 0upx; */
- padding-left: 10upx;
- /* padding-top: 10upx; */
- background-color: #FFFFFF;
- height: 50upx;
- box-shadow: 0upx 0upx 20upx #D3D3D3;
- border-radius: 5upx;
- margin-right: 10upx;
- }
- .button {
- margin: auto;
- width: 60%;
- height: 100upx;
- }
- .button1 {
-
- }
- .p {
- /* #ifdef H5 */
- top: -13%;
- /* #endif */
- width: 50upx;
- height: 30upx;
- font-size: 25upx;
- padding-right: 9upx;
- padding-top: 6upx;
- /* #ifndef H5 */
- /* padding-top: 10upx; */
- /* #endif */
- position: absolute;
- /* 水平居中 */
- left: 50%;
- -webkit-transform: translateX(-50%);
- transform: translateX(-50%);
- }
- .p1 {
- /* #ifdef H5 */
- top: -13%;
- /* #endif */
- width: 80upx;
- height: 60upx;
- font-size: 40upx;
- padding-top: 6upx;
- /* #ifndef H5 */
- padding-top: 10upx;
- /* #endif */
- position: absolute;
- /* 水平居中 */
- left: 50%;
- -webkit-transform: translateX(-50%);
- transform: translateX(-50%);
- }
- .radio {
- padding-top: 20upx;
- padding-left: 30upx;
- }
- .lis {
- padding-left: 90upx;
- font-size: 30upx;
- padding-top: 5upx;
- }
- .title {
- padding-left: 20upx;
- font-size: 35upx;
- }
- </style>
|